View the step-by-step solution to:

Decision Control and Loops with User Interaction: Write a Java application that prompts the user for pairs of inputs of a product number (1-5), and...

Please complete this assignment exactly as the directions say! Thanks.

Decision Control and Loops with User InteracTon: Write a Java applicaTon that prompts the user for pairs of inputs of a product number (1-5), and then an integer quanTty of units sold (these are two separate prompts for input values). You must use a switch statement and a senTnel-controlled loop (i.e., a loop that stops execuTon when an out-of-range value, such as -1, is input). All 15 items below are for a single purchase. ±here are fve sets of inputs as follows: Product 1 1 unit (cost is $2.98 per unit) Product 2 2 units (cost is $4.50 per unit) Product 3 3 units (cost is $9.98 per unit) Product 4 4 units (cost is $4.49 per unit) Product 5 5 units (cost is $6.87 per unit) Your applicaTon must calculate and display the total retail value of all products sold aFer all ²ve pairs of inputs are completed. You must also display the line total and cumulaTve order total aFer each new pair of input values (i.e. a product number and its quanTty) is entered. You must also show the input of the senTnel value and the resulTng display of the total order amount. (taken from Deitel & Deitel, 2012, p. 194). 1. You may use the Windows Command Prompt command line interface or any Java IDE you choose to compile and execute your program. 2. You are to submit the following deliverables to the Assignment Dropbox in a single MicrosoF Word ²le: a. A screen snapshot of your Java source code (just the beginning is OK) as it appears in your IDE (e.g., jGRASP, Net Beans, Eclipse, etc.) or editor (e.g., a Windows Command line more of the .java ²le's ²rst screen). b. A lisTng of your enTre Java source code in the same MicrosoF Word ²le as item a). ±he source code should be placed in the Word ²le so that it follows the screen snapshot from item a). ±o obtain the copy of your source code, you can simply copy and paste the text from your IDE into MicrosoF Word. Be sure to maintain proper code alignment by using Courier font for this item. c. A screen snapshot of your program’s input and output in the same MicrosoF Word ²le, and following item b). You must include screen snapshots of all inputs and all outputs, not just a sample. Your instructor will compile and run your program to verify that it compiles and executes properly. You will be evaluated on (in order of importance ): o Inclusion of all deliverables in Step #2. o Correct execuTon of your program. o Adequate commenTng of your code. o Good programming style (as speci²ed in the textbook's examples).
Background image of page 1
o Neatness in packaging and labeling your deliverables. Defciencies in any oF the above areas are subject to deducTons in each area, based on the severity oF the defciency. For an example of what these assignment components could look like, click the EXAMPLE at the boTom of the screen. Note that there is a single correct answer For the order total ! You must put all your screen snapshots and source code into a single Microso± Word ²le. ³he output should look like this:
Background image of page 2
Sign up to view the entire interaction

Top Answer

The best way to approach your question... View the full answer

import java.text.DecimalFormat;
import java.util.Scanner;
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online