Programming Examples
Create a program that will generate a bill at McDonald based on given details
Create a program that will generate b 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.
Solution
class McDonald
{
public static void main(String arr[])
{
int burger=45,mc_puffs=25,bill,final_bill;
bill=(burger*4)+(mc_puffs*3);
final_bill=bill-50;
System.out.println("Burger @"+burger+"x4 ="+(burger*4)+" Rs.");
System.out.println("McPuffs @"+mc_puffs+"x3 ="+(mc_puffs*3)+" Rs.");
System.out.println("Total "+bill+" Rs.");
System.out.println("Discount 50 Rs");
System.out.println("Final Amount : "+final_bill+" Rs.");
}
}
Output
Burger @45x4 =180 Rs.
McPuffs @25x3 =75 Rs.
Total 255 Rs.
Discount 50 Rs
Final Amount : 205 Rs.