FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 1068   



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



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News