Question: Write a program that accepts the price for an item, amount of payment, and computes the change required to repay a customer. Any purchase less

Write a program that accepts the price for an item, amount of payment, and computes the change required to repay a customer. Any purchase less than $10 incurs a surcharge of 10% of the purchase price.

Requirements:

  • Constants must be defined and used for the tax rate (7%) and the maximum price ($250) and surcharge

    rate of (10%). The tax is applied to the original price of the item that is a prompted input by the user.

  • Output of all dollar amounts (other than dollar-bill/coin denominations) will be of the form $X.XX (U.S. currency format). You must use the System.out.printf() method to format the output of bill and coin amounts.

  • The program will quit when the user enters zero or a negative number.

  • The program will loop until a valid purchase price is entered (0 < price 250). Maximum amount is $250!!! Anything more the program should ask for the price again until given 250 or less.

  • Any purchase price less than $10 must have a 10% surcharge added to the total amount due but calculated on the purchase price. (see session 1) The tax would be added to original price and the 10% is added to the original price.

  • The user must present enough money to pay for the total purchase with a single amount. If the user enters and amount too small to cover the purchase the use must be again asked for a sufficient amount.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!