Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!