[Solved] CSE110 Module3- Change Return

$25

File Name: CSE110_Module3-_Change_Return.zip
File Size: 273.18 KB

SKU: [Solved] CSE110 Module3- Change Return Category: Tag:
5/5 - (1 vote)

Weve developed a new cash register and like most machines, it subtracts the amount owed from the amount received to determine how much money the cashier must return to the customer. However, to avoid some human error, we automatically return the correct change through a coin dispenser. As our companys only software engineer, you need to write the code this function.

You are to accept two amounts: the amount owed, and the amount received. Print a series of messages indicating how many dollars, quarters, dimes, nickels and cents are to be returned. For the dollar amount, just specify a whole number. It is not necessary to break it up into $10s, $5s or $1s. Also note that our coin dispenser does not hand out dollar coins or 50 cent pieces.

If the user provides less than the amount owed, print an error message which includes the amount short and terminate the program. The error message should look something like the following:

*** You did not provide enough money. You are $1.45 short. ***

2. Notes

  • You are to return the fewest number of coins possible. While accurate, it is not acceptable to return 89 pennies if the change is $0.89.
  • Floating point math may cause you some issues. Sometimes 0.10 0.03 is 0.069999 Consider converting to pennies for your internal calculations.
  • Turn in only your source files. Do not use a package (e.g. use dafault).
  1. Required Main Class

CoinMachine

4. Required Input

Amount owed, as a float

Amount Received, as a float

5. Required Output

Your output should look something like the following example. It should include your name.

Coin Machine E. Eckert

Enter the amount owed: 2.34

Enter the amount received: 3.45

Your change today is $1.11

Dollars : 1

Quarters: 0

Dimes : 1

Nickels : 0

Cents : 1

Heres another example:

Coin Machine E. Eckert

Enter the amount owed: 6.45

Enter the amount received: 5.00

*** You did not provide enough money. You are $1.45 short. ***

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE110 Module3- Change Return
$25