tried so hard.. still not working .. its just a simple program

thila's Avatar, Join Date: Mar 2011
Newbie Member
import java.io.*;
Code:
 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)); 
       use = bufferedReader.readLine(); 
         
  int tot=0; 
 int tota=0; 
 int Price1=0; 
  int Price2=0; 
  int Price3=0;   
  String S,M,L; 
     
 for(int i=0;i>=100;i++) 
    
  
  
 { 
         if(use.equals("S")) 
      
       {  
           Price1=550; 
       } 
     
      else if(use.equals("M")) 
         { 
             Price2=800; 
         } 
       else if(use.equals("L")) 
       { 
           Price3=1200; 
       } 
      
       
      tota=tota+tot; 
       
    } 
    tot=Price1+Price2+Price3; 
     System.out.println("The total  price is");  
       System.out.println(tota); 
    } 
     
  
 }
why doesnt this work?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
It really works but may be not as you expect it. What do you expect it to work like?
0
virxen's Avatar, Join Date: Nov 2009
Pro contributor
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); 
    } 
     
  
 }