Q4. A cloth showroom has announced the winter discount on the purchase of certain goods
Answers
import java.util.*;
public class WinterSale
{
public static void main (String args[])
{
Scanner sc=new Scanner (System.in);
System.out.println("Please Enter The Cost");
double amount = sc.nextDouble();
if (amount <= 2000)
{
double discount = ( amount * 5 ) / 100;
double net_amount = amount - discount;
System.out.print("Discount : "+discount);
System.out.println("Net Amount : "+ net_amount);
}
else if (amount >= 2001 && amount <= 5000)
{
double discount = ( amount * 10 ) / 100;
double net_amount = amount - discount;
System.out.print("Discount : "+discount);
System.out.println("Net Amount : "+ net_amount);
}
else if (amount >= 5001 && amount <= 10000)
{
double discount = ( amount * 15 ) / 100;
double net_amount = amount - discount;
System.out.print("Discount : "+discount);
System.out.println("Net Amount : "+ net_amount);
}
else if (amount > 10000)
{
double discount = ( amount * 25 ) / 100;
double net_amount = amount - discount;
System.out.print("Discount : "+discount);
System.out.println("Net Amount : "+ net_amount);
}
sc.close();
}
}