Question

in C please!

Proiect Overview: A business owner is unhappy with the services provided by the government and has chosen to pay the tax using a combination of coins including quarters, dimes, nickels, and pennies. In this project, you are asked to write a program to analyze the tax payment in coins. Th nickels and pennies the owner has paid. It then computes the total amount of tax paid in dollars and cents, and computes the weight of all the coins in pounds. Next assume the same amount of tax will be paid using paper bills in the following denominations: $20 bills, $10 bills, S5 bills, and $1 bills. (If the tax amount contains any cents, round it to the nearest dollar.) The program will figure out how to pay the tax with the minimal number of bills (therefore the minimal weight), and compute the weight of these bills in both grams and pounds. e program first asks for the number of quarters, dimes, When implementing your program, please use the following facts. The weight of coins: quarter (5.67 grams), dime (2.268 grams), nickel (5.0 grams) and penny (2.5 grams) based on According to the Bureau of Engraving and Printing, all U.S. bills weigh one gram When converting weight from Whenever trying to convert a real number into an integer, use the round function in math.h to convert. For example, to convert 2.51, use (int)round(2.51) that gives grams to pounds, use 1 gram0.00220462 pounds. The following is an example cxecution of the program Enter the number of quarters: 44444 Enter the number of dimes: 33333 Enter the number of nickels: 22222 Total payment is 15666 dollars and 51 cents. Total weight of all the coins is 1028.420450 pounds It is recommended to use the following payment form: 783 twenty-dollar bills 0 ten-dollar bills 1 five-dollar bi11s 2 one-dollar bil1s It achieves the minimal weight of 786 grams or 1.732831 pounds.Create a directory project 1 on your machine. In that directory, create a file named payment. c · In payment.c, write the code nceded to solve the problem stated above. Make sure that your program: o Has a header block of comments that includes your name and a brief overview of the program. o Reads four integers. You can assume that all input for this program will be legal (non-negative integers). Do not modify the expected input format or order Computes and prints the expected results. o Please compile the program using gcc -Wall payment. c -1m Once you have a working program, enter some sample data to test it. You are allowed to post the results on Piazza to see whether others agree with your results. However, posting any part of C code from the project on Piazza is prohibited. When you are ready to submit your project, compress your projectl directory into a single (compressed) zip file, project1.zip. See the Basics document on Blackboard if you dont remember how to do it. Once you have a compressed zip file named projectl.zip, submit that file to Blackboard. . Project 1 is due at 5:00pm on Friday, January 25. Late projects are not accepted.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment...

#include<stdio.h>

#include<math.h>

int main(){

int quarters, dimes, nickles, pennies;

printf("Enter the number of quarters: ");

scanf("%d", &quarters);

printf("Enter the nummber of dimes: ");

scanf("%d", &dimes);

printf("Enter the number of nickles: ");

scanf("%d", &nickles);

printf("Enter the number of pennies: ");

scanf("%d", &pennies);

int total_payment = quarters*25 + dimes*10 + nickles*5 + pennies;

float total_weight = (quarters*5.67 + dimes*2.268 + nickles*5.0 + pennies*2.5) * 0.00220462;

int dollars = total_payment/100;

int cents = total_payment%100;

printf("Total payment is %d dollars and %d cents.\n", dollars, cents);

printf("Total weight of all the coins is %f\n", total_weight);

total_payment /= 100;

int twenty_dollar_bills = total_payment/20;

int ten_dollar_bills = (total_payment%20)/10;

int five_dollar_bills = ((total_payment%20)%10)/5;

int one_dollar_bills = ((total_payment%20)%10)%5;

printf("It is recommended to use the following payment form: ");

printf("\n\t%d twenty-dollar bills\n\t%d ten-dollar bills\n\t%d five-dollar bills\n\t%d one-dollar bills\n", twenty_dollar_bills, ten_dollar_bills, five_dollar_bills, one_dollar_bills);

int min_weight = twenty_dollar_bills + ten_dollar_bills + five_dollar_bills + one_dollar_bills;

printf("It achieves the minimal weight of %d grams or %f pounds\n", min_weight, (min_weight * 0.00220462));

return 0;

}

Add a comment
Know the answer?
Add Answer to:
in C please! Proiect Overview: A business owner is unhappy with the services provided by the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PLease help!!! how to type them in Python !!!! Python help!! THank you so much Problem...

    PLease help!!! how to type them in Python !!!! Python help!! THank you so much Problem 1: (20 points) Optimal change You will write a program that uses the // and % operators to figure out how to give change for a specified amount using the minimum number of coins (quarters, dimes, nickels, cents). The good news is that our currency is specifically designed to make this problem easy. For a given number of cents, first use as many quarters...

  • Your program must meet the following specifications: 1. At program start, assume a stock of 10 nickels, 10 dimes, 10...

    Your program must meet the following specifications: 1. At program start, assume a stock of 10 nickels, 10 dimes, 10 quarters, and 10 pennies. 2. Repeatedly prompt the user for a price in the form xX.xx, where X denotes a digit, or to enter q' to quit 3. When a price is entered a. If the price entered is negative, print an error message and start over requesting either a new price or to quit (indicated by entering a 'q)...

  • Can you please help me with creating this Java Code using the following pseudocode? Make Change C...

    Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.)                                                                                                                                  2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...

  • Due: Wednesday June 10, 2020 A travel company has many British travelers going to the US...

    Due: Wednesday June 10, 2020 A travel company has many British travelers going to the US who would like to exchange their British Pounds into American dollars. They want you to explain how the American dollar amount will translate to the number of different bills and coins. There are many different ways to split a particular dollar amount into bills and coins, but they want to have as many high denomination bills and coins as possible. Assume that the highest...

  • C++ HW Question Your program will simulate a simple change maker for a vending machine. It...

    C++ HW Question Your program will simulate a simple change maker for a vending machine. It will start with a stock of coins and dollars. It will then repeatedly request the price for an item to be purchased or to quit. If given a price, it will accept nickels, dimes, quarters, one-dollar and five-dollar bills—deposited one at a time—in payment. When the user has deposited enough to cover the cost of the item, the program will calculate the coins to...

  • Write a C program that calculates exact change. In order to receive full credit, please remember...

    Write a C program that calculates exact change. In order to receive full credit, please remember that only int arithmetic is exact, so you’ll need to break up your double into two ints, the one before the decimal point and the one after the decimal point. Another point worth mentioning is that the % operator gives the remainder. In other words, when working with int values, 9 / 5 = 1 whereas 9 % 5 = 4. Keep this in...

  • it c++ coding. please write on atom software. 1. Write a program that converts dollars into coins a. Request a dolla...

    it c++ coding. please write on atom software. 1. Write a program that converts dollars into coins a. Request a dollar amount as an integer: $5.34 is input as 534 b. Use a constant variable to represent each coin as a fixed value: const int NICKEL 5; c. Use division and the mod function to calculate the number of each coin. Change Calculator Enter dollar amount (as an integer): $534 The equivalent in coins: 21 Quarters 0 Dimes 1 Nickels...

  • In c++ Write a program that asks users to input the amount of money (in cents)...

    In c++ Write a program that asks users to input the amount of money (in cents) that will be exchanged to the least number of coins of the same value, output the results. Assume there are quarters (25c), dimes (10c), nickels(5c) and pennies(1c) available. ■CA 32 cmd.e eas input the anount of money (in cents) you want to exchange 39 39 can be exchanged to uarter: 25 me: 1 kel: e enny: 4 ress any key to continue-.

  • Please use C# For this project, we will see what it's like to write a simple...

    Please use C# For this project, we will see what it's like to write a simple windows application program that we can perform easily in our heads. You'll find that writing programs is similar to explaining things to a 5-year-old. You are to make this program "user friendly". In other words, make sure valid data has been entered. You are to create a simple change program. The user enters the amount due and the amount tendered. You are to calculate...

  • Help with c please Much to the government's dismay, people in the U.S. prefer paper money...

    Help with c please Much to the government's dismay, people in the U.S. prefer paper money to coins. The U.S. Treasury has spent considerable time and effort trying to get people to adopt a $1 coin, but people just don't care for them. Obviously, part of the reason is that coins weigh more than paper money. The question is how much more? This project has you enter the number of paper bills you have in your wallet (twenties, tens, fives...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT