Calculate Bill Calculation Program Using Java

  1.                 /*CLOTH PURCHASE*/  
  2. import java.io.*;  
  3. import java.lang.*;  
  4.   
  5. class ssva11  
  6. {  
  7.    public static void main(String args[]) throws IOException  
  8.     {  
  9.          double netamt = 0;  
  10.          double amt=0,dis=0;  
  11.          int tag=0;  
  12.          int x;  
  13.          String type="";  
  14.            
  15.          do  
  16.          {  
  17.             BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));  
  18.                       
  19.             System.out.println("\tCLOTH PURCHASE\n");  
  20.             System.out.print("\nENTER THE CLOTH PURCHASE AMOUNT : ");  
  21.             amt = Integer.parseInt(obj.readLine());  
  22.             System.out.print("\nENTER THE TYPE(m/h) : ");  
  23.             type = obj.readLine();  
  24.             if(type.equals("m"))  
  25.             tag = 0;  
  26.             else  
  27.             tag = 1;  
  28.             switch(tag)  
  29.             {  
  30.             case 0:  
  31.                    {  
  32.                        System.out.print("\nTHE SELECTED CLOTH IS MILL CLOTH ");  
  33.                        if(amt >100 && amt <201)  
  34.                         netamt = (amt - (amt/100.)* 5);  
  35.                         if(amt >200 && amt <301)  
  36.                          netamt = (amt - (amt/100.)*7.5);  
  37.                         if(amt > 300)  
  38.                          netamt = (amt - (amt/100.)*10);  
  39.                          break;  
  40.                     }  
  41.             case 1:  
  42.                     {  
  43.                        System.out.print("\nTHE SELECTED CLOTH IS HANDLOOM CLOTH ");  
  44.                         if(amt >100 && amt <201)  
  45.                          netamt = (amt - (amt/100.0)*7.5);  
  46.                         if(amt >200 && amt <301)  
  47.                          netamt = (amt - (amt/100.0)*10);  
  48.                         if(amt > 300)  
  49.                          netamt = (amt - (amt/100.0)*15);  
  50.                          break;                  
  51.                     }  
  52.              }  
  53.              System.out.print("\n\nNET AMOUNT IS : "+netamt);                    
  54.              System.out.print("\n\nDO YOU WANT TO CONTINUE[1/0] :");  
  55.              x=Integer.parseInt(obj.readLine());  
  56.          }  
  57.          while(x==1);  
  58.      }   
  59. }  
  60.