Subject Computer Science Java Programming

Question

General Summary: For this assignment, write a Java application that prompts the user for pairs of inputs of a product number (1-5), and then an integer quantity of units sold (these are two separate prompts for input values).

Assignment Description:

Write a Java program to process the 15 items below for a single order. There are five 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)

You must use a switch statement and a sentinel-controlled loop (i.e., a loop that stops execution when an out of range value, such as -1, is input).

You must show all user inputs, including the product numbers, quantities, and sentinel value. You must also show all program outputs.

Your application must calculate and display the cumulative total order amount after each of the five pairs of input values is entered.

You must also show the total order amount after the sentinel value is entered.

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.Scanner;

/**
*
* @author
*/
public class Driver {

    public static void main(String[] args) {
       Scanner input = new Scanner(System.in);
       double total = 0.0;
       int option = 0;
       int set;
       int number;
       int quantity;
       int order = 1;
       while (option != -1) {
            int quantities[] = {0, 0, 0, 0, 0, 0};
            set = 0;
            double orderCost = 0.0;
            System.out.printf("Order %d:%n", order);...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Simple Mathematical Computations in Java
Homework Solution
$20.00
Java
Programming
Codes
Algorithms
Mathematics
Computer Science
Objects
Summation
Odd Digits
Even Digits
ItemIndex
Functions
Integers
Multiple Values
Statements
Variables
Input
Output
Java Programming Problems
Homework Solution
$38.00
Java
Programming
Computer Science
Palindromes
Methods
Functions
Loops
Input
Output
Insertion Sort
Algorithms
Arrays
Integers
Strings
Java Problems: Euclidean Distance and Arrays
Homework Solution
$20.00
Java
Programming
Computer Science
Coding
Euclidean Distance
Reversing an Array
String Values
Integer Values
Boolean Arrays
Input
Output
Square Root
Sum of Squares
Mathematics
Vectors
Rows
Columns
Java Program For Vending Machine
Homework Solution
$40.00
Java
Programming
Computer Science
Vending Machine
Drinks
Password
Screen
Inventory
Menu
Errors
Money
Simple Calculator in Java
Homework Solution
$25.00
Programming
Computer Science
Java
Calculator
Mathematics
Operations
Variables
Statements
Functions
Methods
Strings
Integers
Sentences
Expressions
Wrong Inputs
Errors
Accounting Problems Using Java
Homework Solution
$45.00
Java
Programming
Codes
Algorithms
Computer Science
Statements
Variables
Loops
Input
Output
Integers
Interest Rates
Account Balance
Display Messages
Compounding Interest
Strings
Dates
Analysis
Get help from a qualified tutor
Live Chats