Computer Science, asked by monikamishra1010, 10 months ago

Please write a java program .......... For it

Attachments:

Answers

Answered by anuragmukherjee74
2

Program:-

// To display discount using scanner class.

import java.util.*;

public class Discount

{

public static void main()

{

Scanner in = new Scanner(System.in);

int a,b,d;

System.out.println("Enter the purchase amount");

a = in.nextInt();

if (a > 2000)

{

d=0.05*a

b=a-d;

System.out.println("The amount to be paid" +b);

}

else if (a > 2001) && (a > 5000)

{

a=0.25*a;

b=a-d;

System.out.println("The amount to be paid" +b);

}

else if (a > 5001) && (a > 10000)

{

a=0.35*a;

b=a-d;

System.out.println("The amount to be paid" +b);

}

else

d=0.50*a;

b=a-d;

System.out.println("The amount to be paid" +b);

}

}

}

Similar questions