View Single Post
Pro contributor
17Mar2011,01:33  
virxen's Avatar
try this

Code:
import java.io.*; 
class pizza 
 { 
    public static void main (String[] args) throws Exception { 
       String use; 
       System.out.println("Large - L, "); 
       System.out.println(" Medium - M"); 
       System.out.println(" Small - S"); 
       BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); 
        long total=0; 
         for(int i=0;i<10;i++) {
             System.out.println("give size(S,M, or L):");
             use = bufferedReader.readLine(); 
             int Price=0;
              if(use.equalsIgnoreCase("S"))
                   Price=550;  
               else if(use.equalsIgnoreCase("M")) 
                 Price=800; 
               else if(use.equalsIgnoreCase("L")) 
                   Price=1200;
               System.out.println("the size you have chosen costs "+Price) ;
              total+=Price; 
        }  
         System.out.println("The total  price is "+total); 
    } 
     
  
 }