Please write a java program .......... For it
Attachments:
Answers
Answered by
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
English,
4 months ago
Science,
4 months ago
Computer Science,
4 months ago
Computer Science,
10 months ago
Physics,
10 months ago
English,
1 year ago