Question: import java.util.Scanner;public class OnlineShoppingStore { { public static void main ( ( String [ ] [ ] args ) { ) { Scanner scanner =

import java.util.Scanner;public class OnlineShoppingStore {{ public static void main((String[][] args){){ Scanner scanner == new Scanner((System..in)); int total =0=0; int quantity; System.out.println("("Welcome to our online store!")); System.out.println("1("1: Banana, 0.99")0.99"); System.out.println("2("2: Apple, 1.99")1.99"); System.out.println("3("3: Orange, 0.79")0.79"); System.out.println("4("4: Grapes, 2.99")2.99"); System.out.println("("Please select an item (14)(1-4) or 1-1 to exit:")); int item == scanner.nextInt()(); while ((item !=1){!=-1){ System.out.println("("Please enter the quantity of the selected item:")); quantity == scanner.nextInt()(); switch ((item){){ case 11: System.out.println("("You have selected Banana, price 0.99")0.99"); total +=+= quantity *0.99*0.99; break; case 22: System.out.println("("You have selected Apple, price 1.99")1.99"); total +=+= quantity *1.99*1.99; break; case 33: System.out.println("("You have selected Orange, price 0.79")0.79"); total +=+= quantity *0.79*0.79; break; case 44: System.out.println("("You have selected Grapes, price 2.99")2.99"); total +=+= quantity *2.99*2.99; break; }} System.out.println("1("1: Banana, 0.99")0.99"); System.out.println("2("2: Apple, 1.99")1.99"); System.out.println("3("3: Orange, 0.79")0.79"); System.out.println("4("4: Grapes, 2.99")2.99"); System.out.println("("Please select an item (14)(1-4) or 1-1 to exit:")); item == scanner.nextInt()(); }} System.out.println("("Your total is "+"+ total)); }}}}
Write an explanation for this java code

Step by Step Solution

3.46 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This Java code represents a simple online shopping store program that allows users to select items a... View full answer

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 Programming Questions!