Write a C# console program to input two doubles, engineering homework help

Write a C# console program to input two doubles. The first represents the price of an item and the second is the amount of money being paid. Your program should issue the proper change which includes the number one dollar bills, the number of quarters, the number of dimes, the number nickels, and the number of pennies. All of the output numbers should be integers with appropriate comments.

For example, your program output might look like this:

Enter the price of the item: 6.53 Enter the amount paid: 10.00 Your change is: 3 ones 1 quarter 2 dimes 0 nickels 2 pennies.

If the first number entered by the user greater than the second, your program should print the message: Not enough money offered.

The next page has a design for the solution to this problem. Follow the program design and write the implementation code as a console application in C#.

Name: Joe Student

Date: January 18, 2016

Assignment: Assignment 1

This program inputs two doubles representing the cost of an item and the amount being paid. I prints the correct change.
Design main()

{Issue prompts for the item cost. Input the cost as a double Issue a prompt for the amount paid. Input the paid amount as a double.

if (cost is greater than the amount paid) {Print message indicating not enough money paid in. } else {calculate the change. ones = integer part of change change = change – ones quarters = (integer part of change * 100)/25 change = change = .25 * quarters dimes = (integer part of change * 100)/10 change = change – .10 * dimes nickels = (integer part of change * 100)/5 change = change – .05* nickels pennies = 100 * change print ones, quarters, dimes, nickels, and pennies with an appropriate message } return; } //End of main code

Note that because of round off error with floating point numbers you may be off by a penny or two. This could be fixed by working with all integers but that is not necessary for this problem.

 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"