Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DRAW A FLOWCHART WHILE LOOP Scanner input = new Scanner(System.in); double totalRetailvalue = 0; int prodctNum = 0; int quantity = 0; System.out.println(Enter the product

DRAW A FLOWCHART WHILE LOOP

Scanner input = new Scanner(System.in); double totalRetailvalue = 0; int prodctNum = 0; int quantity = 0; System.out.println("Enter the product number or (0 to exit): "); prodctNum = input.nextInt(); while (prodctNum != 0) { System.out.println("Enter the product quantity : "); quantity = input.nextInt(); double retailPrice;

switch (prodctNum) { case 1: retailPrice = 2.98; break; case 2: retailPrice = 4.50; break; case 3: retailPrice = 9.98; break; case 4: retailPrice = 4.49; break; case 5: retailPrice = 6.87; break; default: retailPrice = 0; break; } totalRetailvalue = retailPrice*quantity; System.out.println("Enter the product number or (0 to exit): "); prodctNum = input.nextInt(); }

System.out.printf("The Total retail value of all products sold: RM%.2f ", totalRetailvalue);

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

how do you code the schrodinger equation in python with hamiltonian

Answered: 1 week ago