A waiter or waitress serving an individual table at a restaurant is usually tipp
ID: 3725761 • Letter: A
Question
A waiter or waitress serving an individual table at a restaurant is usually tipped between 15 and 20% of the cost of the meal. However, some restarurants don't leave the amount of the tip up to the customer and charge a fixed percentage of the meal. First, complete the calcTip() method shown below for a party of two. Then, Write a complete overloaded method called calcTip which calculates the tip at the rate of 17.5%. (Note: You will submit two methods for this question.)
//post condiditon: returns the amount of the tip
public double calcTip(double percent, double mealCost) {
//complete the code for the first method here
}
//second method to be written here
Explanation / Answer
Dear Student,
here are the answers..
==============================================================
Method1:
public double calcTip(double percent, double mealCost)
{
double tip = mealCost * (percent/100);
return tip;
}
===============================================================
method 2:
public double calcTip(double mealCost)
{
double tip = mealCost * 17.5/100;
return tip;
}
===============================================================
KIndly Check and Verify Thanks..!!!
==============================================================
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.