Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Java program that plays the role of a cash register. The program is to work as follows: 1. Prompt a user for
Write a Java program that plays the role of a cash register. The program is to work as follows: 1. Prompt a user for the amount of sale and then read the amount. Next, prompt the user for the amount tendered and read it too. 2. a. Compute the total change. b. Compute the number of dollar bills, quarters, dimes, nickels and cents in the total change. c. Display the total change, and its denominations - Dollars, quarters, dimes, nickels, and cents. USE PROPER DOCUMENTATION AND INDENTATION. YOUR OUTPUT MUST LOOK LIKE THE SAMPLE BELOW. ENTER AMOUNT OF SALE: $ 8.28 ENTER AMOUNT TENDERED BY CUSTOMER: $10.00 TOTAL CHANGE = $ 1.72 = 1 = 2 = 2 = 0 = 2 DOLLARS QUARTERS DIMES NICKELS CENTS THANK YOU FOR USING (your name) CASH REGISTER PROGRAM Run your program several times, each time with a new pair of data from below: Amount of Sale 8.28 162.01 92.00 5.68 201.56 O O O Amount Tendered 10.00 175.00 95.00 5.69 201.56 Please turn in the following documents, staple them together: 1. The source code. 2. Screen shots of all the output General Rubric for programming assignments Comments/proper identification/indentation Add name(s) of all authors, class, assignment #, and purpose to the program (2 points) Use additional comments explaining your steps at least once every five lines. (2 points) Use proper indentation (6 points) Compilation/execution (40 pts) o Program must compile without syntax errors. You will get 0% score if it does not compile. You should be able to fix at least all the syntax errors in your program. No output, no grade. your o Program must execute and yield the correct output. You may get less than 50% of the total score if program does not give the correct output. Make sure to test it with any given test data and that the output is as specified in the assignment.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
import javautilScanner public class CashRegister public static void mainString args Scanner scanner new ScannerSystemin Prompt user for amount of sale SystemoutprintEnter the amount of sale double sal...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