logo image

Discount Calculator program in Java



Java program which computes the Discount, It takes total amount and discount percentage and it prints the final price.

import java.util.Scanner;

public class DiscountCalculator {
	
	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		System.out.println("Enter bill amount: ");
		int bill = in.nextInt();
		System.out.println("Enter discount (%): "); 
		int discount = in.nextInt();
		in.close();

		System.out.println("Your bill after discount is " + (bill - (bill * discount / 100)));
		
	}
}

Output:

Enter bill amount: 
2000
Enter discount (%): 
15
Your bill after discount is 1700