Question
Write a Java console application that computes the change of a purchase transaction. The console application will produce only the following: Prompt the user for
Write a Java console application that computes the change of a purchase transaction. The console application will produce only the following:
Prompt the user for a purchase amount
Prompt the user for the amount of money tendered
Validate that the purchase amount is less than or equal to the amount tendered, if not, do not let the user continue until this business rule is followed by the user. Produce a message to the user when this rule is broken
From the difference between the purchase amount and the amount tendered, calculate the amount of cents in change
i. Example
1. Purchase is $3.50, the amount tendered is $5.00, calculate the coins on $0.50
Produce a message which reports the number of quarters, dimes, nickels and pennies that will be issued in the change from a purchase
i. Example
1. For a purchase amount of $56.57, the amount tendered is $60.00, calculate the coins on $0.43 and the message produced will be
Use looping to calculate the coins
If no coins are to be issued, produce a message to the user
i. Example
1. For a purchase amount of $60.00, the amount tendered is $60.00
a. Produce a message No coins to issue
Use big decimal for the user inputs
Prompt the user after the calculation if they wish to execute another transaction. Prompt the user for y or n. If the user enters y, begin the application from the start of the workflow, if n exit the application.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started