ICSE Class 8 Computer Studies Question 8 of 8

Introduction to Java & BlueJ — Question 8

Back to all questions
8
Question

Question 8

Create a program that will generate a bill at McDonald's for four vegetable burgers (@ Rs 45 per vegetable Burger) and three vegetable McPuffs (@ Rs 25 per vegetable McPuff). There is a special Independence Day discount of Rs 50 on the final bill amount.

public class KboatMcDBill
{
    public static void main(String args[]) {
        int vegBurgerCost = 4 * 45;
        int vegMcPuffCost = 3 * 25;
        int total = vegBurgerCost + vegMcPuffCost;
        int amt = total - 50;
        System.out.println("4 Vegetable Burgers @ 45 = " + vegBurgerCost);
        System.out.println("3 Vegetable McPuffs @ 25 = " + vegMcPuffCost);
        System.out.println("Total = " + total);
        System.out.println("Discount = 50");
        System.out.println("Final Bill = " + amt);
    }
}
Output
BlueJ output of KboatMcDBill.java
Answer