jawa

jawa

Prompt the user to choose an item/product using the number (1,2,3) that corresponds to the item, or to enter 0 to quit the application. After the user makes the first selection, if the choice is 0, display a bill of RM0. Otherwise, display the menu again.

View Answers

September 2, 2011 at 4:39 PM

import java.util.*;
class ChoiceExample 
{
    public static void main(String[] args) 
    {
        double price=0;
        Scanner input=new Scanner(System.in);

        boolean exit=false;
        do{
        System.out.println("0 Exit");
        System.out.println("1 Toys");
        System.out.println("2 Books");
        System.out.println("3 Bags");

        System.out.print("Enter your choice: ");
        int choice=input.nextInt();
        switch(choice){
           case 0:
                exit=true;
                System.exit(0);
                break;
           case 1:
                price=200;
                System.out.println("Price is: "+price);
                break;
           case 2:
                price=500;
                System.out.println("Price is: "+price);
                break;
           case 3:
                price=250;
                System.out.println("Price is: "+price);
                break;

        }
        }
        while(!exit);
        }
    }









Related Tutorials/Questions & Answers:
jawa
ModuleNotFoundError: No module named 'jawa'
ModuleNotFoundError: No module named 'jawa'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'jawa' How to remove the ModuleNotFoundError: No module named 'jawa' error
Advertisements
ModuleNotFoundError: No module named 'jawa-repo'
ModuleNotFoundError: No module named 'jawa-repo'  Hi, My Python... 'jawa-repo' How to remove the ModuleNotFoundError: No module named 'jawa... have to install padas library. You can install jawa-repo python with following
Convert to java - Java Beginners
hari : Jawa (hari pasar) sBulanE = namaBulanE[iBulanM]; //string nama... - Jawa //iTanggalM : int tanggal Masehi (Inggris/Indonesia) //iTanggalH : int tanggal Hijriah (Arab/Indonesia/Jawa) zTanggalM = iTanggalM<10
Difference between Java 6 and Java 7
Needless to say, today Java has become the most widely object oriented programming languages and it has been playing crucial role by using this from software development to web development. Jawa was first of originated by Sun

Ads