Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please follow up the instructions java Write a Java program that will prompt the user for a purchase amount. If this bill amount is valid,

please follow up the instructions
java image text in transcribed
Write a Java program that will prompt the user for a purchase amount. If this bill amount is valid, then prompt the user again for the payment amount. If this is valid then compute the change to be returned. This amount should be displayed in pennies, nickels, dimes, quarters, single dollar bills, five-dollar bills, ten-dollar bills, and 20 dollar bills. If either of the input values are invalid, an error message should be displayed explaining precisely where the error is. Sample run number 1: This program will compute the proper change from a purchase. Please enter the purchase amount: $1.32 Please enter the payment amount: $20 The change is: 1 TEN(S) 1 FIVE(S) 3 ONE(S) 2 QUARTER(S) 1 DIME(S) I NICKEL(S) 3 PENNIES Sample run number 2: This program will compute the proper change from a purchase. Please enter the purchase amount: $-1 The purchase amount has an error! The purchase amount must be at least 1 cent. Sample run number 3: This program will compute the proper change from a purchase. Please enter the purchase amount: $7.32 Please enter the payment amount: $5 The payment amount has an error. Payment amount must be at greater than or equal to the purchase amount

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

5. Efforts to streamline HRM processes.

Answered: 1 week ago