Question: Tip calculator in Java 2. Calculating a tip when you go to a restaurant based on service is something we all do. However current tip

Tip calculator in Java

Tip calculator in Java 2. Calculating a tip when you go to

2. Calculating a tip when you go to a restaurant based on service is something we all do. However current tip recommendations are not based on degree of satisfaction. This program should create such a tip calculator In the Tip class: a. Create an instance variable called satisfactionRating. This variable should be an int. b. Create a constructor that initializes the satisfactionRating variable. should be an argument from the tester program. The satisfaction rating c. Create a method that calculates a tip and name it calcTip. The method should return a type double value (decimal number) which represents the tip amount. You should have a parameter variable called bill which is a type double. If the satisfactionRating is 1, calculate the tip as 20% of the bill amount. If the satisfactionRating is 2, calculate the tip as 15%. If the satisfactionRating is 3, calculate the tip as 10%. Return the calculated value. In the tester class: Create a Scanner object. Ask the user to input the cost of the meal. Ask the user to input a satisfaction rating of 1 for totally satisfied, 2 for satisfied, and 3 for dissatisfied. Create a Tip object using the input from c. Call the method calcTip and use the cost of the meal from b as your argument. (Remember the cost of the tip will be returned) Create a new variable, totalMeal, that is the cost of the meal (which you got in b) plus the tip which you got in step e. Print the satisfaction level as :Very Satisfied, Satisfied, or Dissatisfied (hint: you will need a set of "if statements to do this), the cost of the meal, the tip, and the total cost of the meal. a. b. c. d. e. f. e

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!