Pls Answer This Question it is in the attachment below
Answers
import java.util.*;
public class Discount
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Please Enter The Length Of Cloth");
int L = sc.nextInt();
System.out.println("Please Choose The Type Of Customer");
System.out.println("(D)Dealer");
System.out.println("(R)Retailer");
char T = sc.next().charAt(0);
switch (T)
{
case 'D' :
{
if ( L == 1000 )
{
System.out.println("20% Discount");
}
else if ( L >= 1000 && L<= 2000 )
{
System.out.println("25% Discount");
}
else if ( L >2000 )
{
System.out.println("35% Discount");
}
else
{
System.out.println("Invalid");
}
System.exit(0);
break;
}
case 'R' :
{
if ( L == 1000 )
{
System.out.println("15% Discount");
}
else if ( L >= 1000 && L<= 2000 )
{
System.out.println("20% Discount");
}
else if ( L >2000 )
{
System.out.println("25% Discount");
}
else
{
System.out.println("Invalid");
}
System.exit(0);
break;
}
}
sc.close();
}
}