Write a program to simulate a cash register change


Write a program to simulate a cash register change calculator. Assume that you have two double variables that have been declared and initialized with some values: cost and amtPaid. Assume that amtPaid is greater than or equal to cost. 

cost represents the amount that the customer owes to the store, and amtPaid is the amount that the customer is giving to the store. Your program should calculate and print the total change due, and print how to give back the change.

For example, if cost is $52.32, and the amtPaid is $100, your program should print:Your change is $47.682 $20 bill(s)1 $5 bill(s)2 $1 bill(s)2 Quarter(s)1 Dime(s)1 Nickel(s)3 Penny(ies)You don't have to use dollar amounts greater than $20 in giving back your change. Your code should not print anything for a change amount that is not used; for example, do not print "0 $10 bill(s)" in the example shown above.(Recall that 47.68 - (int)47.68 would be 0.68.)

 

 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write a program to simulate a cash register change
Reference No:- TGS01129400

Expected delivery within 24 Hours