MAKING BILL IN JAVA
import java.util.Scanner;
class laptop
{
public static void main()
{
int amount,disa;
Scanner dhiren = new Scanner(System.in);
System.out.println("Enter the price of the laptop to calculate the discount : ");
amount = dhiren.nextInt();
if (amount >= 20000 && amount <= 30000)
{
amount = amount - (amount * 30 )/100;
System.out.println("Dicounted price is : "+amount);
disa = amount;
amount = disa + (disa * 14)/100;
System.out.println("After adding GST is : "+amount);
System.out.println("Dear customer you have to pay : "+amount);
}
else if (amount >= 30000 && amount <= 40000)
{
amount = amount - (amount * 30 )/100;
System.out.println("Dicounted price is : "+amount);
disa = amount;
amount = disa + (disa * 14)/100;
System.out.println("After adding GST is : "+amount);
System.out.println("Dear customer you have to pay : "+amount);
}
else if (amount >= 40000 && amount <= 50000)
{
amount = amount - (amount * 30 )/100;
System.out.println("Dicounted price is : "+amount);
disa = amount;
amount = disa + (disa * 14)/100;
System.out.println("After adding GST is : "+amount);
System.out.println("Dear customer you have to pay : "+amount);
}
else if ( amount >= 50000)
{
amount = amount - (amount * 30 )/100;
System.out.println("Dicounted price is : "+amount);
disa = amount;
amount = disa + (disa * 14)/100;
System.out.println("After adding GST is : "+amount);
System.out.println("Dear customer you have to pay : "+amount);
}
else
{
System.out.println("There is no discount under 20,000");
}
}
}
0 Comments