Write a Java program that plays the role of a cash register. The program is to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
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... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Let r and s be solutions to the quadratic equation x 2 b x + c = 0. For n N, define d0 = 0 d1 = r s dn = b dn1 c dn2 (n 2) Prove that dn = r n s n for all n N. [4 marks] (b) Recall that a commutative...
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
The following table includes the GNP(X) and the demand for food (Y) for a country over ten years period. Year 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 Y 6 7 8 10 8 9 10 9 11 10 X 455555 50...
-
According to the data in Figure 15.4, by what percent did world GDP per capita grow from 1. 1000 to 1500? 2. 1500 to 1820? 3. 1820 to 1995? Figure 15.4 $8,000 5,000 4,000 - 3,000 - 2,000 1,000 Growth...
-
Oil is poured onto a flat surface and a circular patch is formed. The radius of the patch increases at a rate of 2r cms 1 . Find the rate at which the area is increasing when the circumference is 8cm.
-
Petitioner Curtis Flowers has been tried six separate times for the murder of four employees of a Mississippi furniture store. Flowers is black; three of the four victims were white. At the first two...
-
1. Prepare a context diagram for the new system. 2. Prepare a diagram 0 DFD for the new system. 3. Write a brief memo that explains at least five attributes that you can use to define a process in...
-
A 480-g iron pan is heated on a stove to a temperature of 130 C. The pan is then dropped into a partially-filled sink of water at 20 C. The final temperature reached by the sink and the pan is 40 C....
-
Matthew and Madison Abbott are both 32 years old. They have two kids Tori, age 6 and Trace, age 3. Using the Needs Approach, help the Abbott family determine how much insurance is needed on Matthew's...
-
A vehicle was purchased on 1st January 2021 for 32,000 and the depreciation method was Reducing Balance at a rate of 20%. The residual value at the end of its useful life is 20,000. What is the...
-
You are employed by Mobility Global (MG) as a Senior Management Accountant. Like other businesses, MG has been exposed to challenges facing the UK including Brexit, COVID-19, The Russo-Ukranian War,...
-
Assuming that the fixed costs of producing the new product are $1,000,000, and the variable costs are $1,000 per unit, how many units does ABC Ltd. have to sell to break even at a price of $2,000?
-
according to the following 2017 data for floyd company, a closely held corporation, what is its taxable income? Net passive loss. $5,000 Net active income. $3,000 Net portfolio income $4,000
-
A fixed asset with a cost of $34,636.00 and accumulated depreciation of $31,172.40 is sold for $5,888.12. What is the amount of the gain or loss on disposal of the fixed asset?
-
Looney, Inc company produces several electronic devices in their Georgia factory. Looney, Inc has the following costs related to manufacturing and selling 100,000 B37 devices. Direct materials...
-
A spring has a natural length of 10 in. An 800-lb force stretches the spring to 14 in. (a) How much work is done in stretching the spring from 10 in. to 12 in.? (b) How far beyond its natural length...
-
SCHEDULE OF COST OF GOODS MANUFACTURED The following information is supplied for Sanchez Welding and Manufacturing Company. Prepare a schedule of cost of goods manufactured for the year ended...
-
Write a program that takes user input describing a playing card in the following shorthand notation: A.....Ace 2.....10 Card values J......Jack Q....Queen K.....King D.....Diamonds H.....Hearts...
-
Explain what the following code prints. Draw a picture of the linked list after each step. LinkedList staff = new LinkedList (); staff.addFirst("Harry"); staff.addFirst("Diana");...
-
Of the following pairs of strings, which comes first in lexicographic order? a. "Tom", "Jerry" b. "Tom", "Tomato" c. "church", "Churchill" d. "car manufacturer", "carburetor" e. "Harry", "hairy" f....
-
Assume that the economy can experience four possible states: high growth, normal growth, recession, or depression. For each of those states, you expect the following stock market returns for the...
-
Suppose an investment pays off $800 or $1,600 with equal probability per $1,000 invested. What is the maximum leverage ratio you could have and still have enough to repay the loan in the event the...
-
The imposition of new trade tariffs has resulted in tensions between the United States and some of its major trading partners. Suppose you are a small business owner in the United States. a. How...
Study smarter with the SolutionInn App