Grocery store discount system scenario
A Grocery store provides discount based on the total bill amount
Above Rs.1000: 20% discount
Rs.500 to Rs.1000: 10% discount
Below Rs.500: No discount
Write a java program that calculates the final bill amount after applying the discount
import java.util.*;
class ASC
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
System.out.println(“Enter total bill amount:Rs.”);
double bill=s.nextDouble();
double discount=0;
if(bill>1000)
{
discount= bill*0.20;
}
else if(bill>=500 && bill<=1000)
{
discount=bill*0.10;
}
else
{
discount=0;//no discount
}
double finalbill=bill-discount;
System.out.println(“Discount=” +discount);
- System.out.println(“Final bill is here=” +finalbill);
}
}