You are on page 1of 1

import java.util.

*;
class ClothShowroom
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
float amt;
float disc=0.0f;
System.out.println("Enter the amount : ");
amt=sc.nextFloat();
char cat;
System.out.println("Input the category M-mill cloth H-handloom");
cat=sc.next().charAt(0);
switch(cat)
{
case 'H':
{
if(amt<=100)
disc=0.05f;
else if (amt<=200)
disc=0.075f;
else if (amt<=300)
disc=0.1f;
else if(amt>300)
disc=0.15f;
break;
}
case 'M':
{
if(amt<=100)
disc=0.0f;
else if (amt<=200)
disc=0.05f;
else if (amt<=300)
disc=0.075f;
else if(amt>300)
disc=0.1f;
}
}
amt=amt-(amt*disc);
System.out.println("Amount to be paid= "+amt);
}
}

You might also like