pls answer it using the if... else...if statement in JAVA
Attachments:
Answers
Answered by
6
class P
{
public static void main()
{
int a;
if(a<2000)
{
System.out.println("The discount is :" + (15/100)* a);
if(a>=2001 && a<=5000)
System.out.println("The discount is :"+ (25/100) *a);
if(a>=5001 && a<=10000)
System.out.println("The discount is :" + (35/100)*a) ;
else
{
System.out.println("The discount is :" + (50/100) * a);
}
}
}
}
{
public static void main()
{
int a;
if(a<2000)
{
System.out.println("The discount is :" + (15/100)* a);
if(a>=2001 && a<=5000)
System.out.println("The discount is :"+ (25/100) *a);
if(a>=5001 && a<=10000)
System.out.println("The discount is :" + (35/100)*a) ;
else
{
System.out.println("The discount is :" + (50/100) * a);
}
}
}
}
Similar questions