Q:

Calculate Bill Calculation Program Using Java

0

This Program is used to calculate the Bill Calculation Program using Java

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

/*CLOTH PURCHASE*/


import java.io.*; 
import java.lang.*; 

class ssva11 
{ 
public static void main(String args[]) throws IOException 
{ 
double netamt = 0; 
double amt=0,dis=0; 
int tag=0; 
int x; 
String type=""; 

do 
{ 
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in)); 

System.out.println("\tCLOTH PURCHASE\n"); 
System.out.print("\nENTER THE CLOTH PURCHASE AMOUNT : "); 
amt = Integer.parseInt(obj.readLine()); 
System.out.print("\nENTER THE TYPE(m/h) : "); 
type = obj.readLine(); 
if(type.equals("m")) 
tag = 0; 
else 
tag = 1; 
switch(tag) 
{ 
case 0: 
{ 
System.out.print("\nTHE SELECTED CLOTH IS MILL CLOTH "); 
if(amt >100 && amt <201) 
netamt = (amt - (amt/100.)* 5); 
if(amt >200 && amt <301) 
netamt = (amt - (amt/100.)*7.5); 
if(amt > 300) 
netamt = (amt - (amt/100.)*10); 
break; 
} 
case 1: 
{ 
System.out.print("\nTHE SELECTED CLOTH IS HANDLOOM CLOTH "); 
if(amt >100 && amt <201) 
netamt = (amt - (amt/100.0)*7.5); 
if(amt >200 && amt <301) 
netamt = (amt - (amt/100.0)*10); 
if(amt > 300) 
netamt = (amt - (amt/100.0)*15); 
break; 
} 
} 
System.out.print("\n\nNET AMOUNT IS : "+netamt); 
System.out.print("\n\nDO YOU WANT TO CONTINUE[1/0] :"); 
x=Integer.parseInt(obj.readLine()); 
} 
while(x==1); 
} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now