Write a program that computes the tax, tip and total for a restaurant bil. o Sin
ID: 3879694 • Letter: W
Question
Write a program that computes the tax, tip and total for a restaurant bil. o Since we haven't yet learned how to prompt for input into our programs, declare a variable for the meal charge and assign it a value of 44.35. The tax should be 6.75 percent of the meal charge The tip should be 15 percent of the total after adding the tax Display (ie. Output) the meal charge, tax amount, tip amount, and the total amount. so the tip calculation is the meal charge plus the calculated tax amount times 15% ° Charge for the meal:44.35 Tax Amount (rate.0675) 2.993625 Tip Amount (@ 15) Total Amount 10154375 54.4451688Explanation / Answer
Class RestaurantBill
{
public static voiid main(String args[])
{
double tax,tip;total;
double meal= 44.35d;
tax= 0.675*meal;
tip=(meal+tax)*0.15;
total=meal+tax+tip;
System.out.println("meal charge="+meal);
System.out.println("tax amount="+tax);
System.out.println("tip amount="+tip);
System.out.println("total amount="+total);
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.