10. Mega Market has announced festival discounts on the
purchase of items, based on the total coast of the items
purchased:
Total cost
Up to 72,000
72,ool to 75,000
25,001 to loooo
Above & 19ooo
Discount
5 %
10%.
15%
20%
Write a program to input the total cost. Display name of
the customer discount and the amount to be paid after discount.
Answers
Answered by
1
import java.util.Scanner;
public class KboatClothDiscount
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter total cost: ");
double cost = in.nextDouble();
double amt;
if (cost < 2000) {
amt = cost - (cost * 5 / 100.0);
}
else if (cost < 5000) {
amt = cost - (cost * 25 / 100.0);
}
else if (cost < 10000) {
amt = cost - (cost * 35 / 100.0);
}
else {
amt = cost - (cost * 50 / 100.0);
}
System.out.println("Amount to be paid: " + amt);
}
}
OUTPUT
Similar questions
Political Science,
19 days ago
Computer Science,
19 days ago
India Languages,
1 month ago
English,
7 months ago
Chemistry,
7 months ago
Math,
7 months ago