XYZ Company gives a discount on the total amount
of goods sold as per the following table. Accept the
product price and the number of units sold. Calculate
theamount of discount applicable and the amount
payable.
Total Cost
>=Rs.100,000 7.5%
>=Rs.50,000<Rs.100,000
>=Rs.25,000<Rs.50,000
>=Rs.10,000<Rs.25,000
<Rs.10,000
Discount rate
7.5%
5%
3.5%
2%
1%
Answers
Answered by
2
Answer:
import java.util.Scanner;
public class KboatDiscount
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter Name: ");
String name = in.nextLine();
System.out.print("Enter Purchase Amount: ");
double amt = in.nextInt();
int d = 0;
if (amt <= 10000)
d = 15;
else if (amt <= 20000)
d = 20;
else
d = 30;
double discAmt = amt * d / 100.0;
double finalAmt = amt - discAmt;
System.out.println("Name: " + name);
System.out.println("Purchase Amount: " + amt);
System.out.println("
Similar questions
Social Sciences,
3 hours ago
Social Sciences,
3 hours ago
Math,
6 hours ago
English,
7 months ago
English,
7 months ago
Math,
7 months ago