Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Calculating a tip when you go to a restaurant based on service if something we all do. However, current tip recommendations are not based on

image text in transcribed

Calculating a tip when you go to a restaurant based on service if something we all do. However, current tip recommendations are not based on degree of satisfaction. This program should create such a tip calculator. 1. In the Tip class: a. Create a Tip class. b. Create an instance variable called satisfactionBating. This variable should be an int. c. Create a constructor. The constructor sets (initializes) satisfactionBating variable to the value in the parameter. d. Create a method, calculateBil. It will calculates a tip, calcTip,and add it to the cost of the meal. The method should have a double argument which you should name bill that represents the cost of the meal before the tip. Create a variable which is a double and called tip. If the satisfactionRating is 1, multiple the bill by 20% and assign it to the variable named tip. If the satisfactionRating is 2, multiple the bill by 15% and assign it to the variable named tip. If the satisfaction Rating is 3, multiple the bill by 10% and assign it to the variable named tip. Add the tip to the bill and return the calculated value. The method should return a double which represents the numeric calculation of the tip the cost. In the tester class: a. Create a main. b. Create a Scanner object. (Don't forget you have to import it.) c. Prompt the user to input the cost of the meal d. Create a double variable named mealCost and assign the user input to it. e. Prompt the user to input a satisfaction rating of 1 for totally satisfied, 2 for satisfied, and 3 for dissatisfied f. Create an int named satisfaction and assign the user input to it. g. Create a Tip object using satisfaction h. Call the method alculateBill and use mealCost your parameter input. Assign the returned value to a variable named totalCost. It should be a double Create a string variable named satisfactionLevel, You should convert the jnt satisfaction from the numerical value to the appropriate word representation. For example, if(satisfaction1)satisfactionLevel- "Totally Satisfied";) Print the satisfactionLevelso that it reads Satisfaction is: XXXX Print the cost of the meal. This was input in step d. It should read The cost of the meal was: i. j. k. I. Print the totalCost of the meal. It should read The total cost of the meal was: xxx

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 23rd International Conference Dexa 2012 Vienna Austria September 2012 Proceedings Part 1 Lncs 7446

Authors: Stephen W. Liddle ,Klaus-Dieter Schewe ,A Min Tjoa ,Xiaofang Zhou

2012th Edition

3642325998, 978-3642325991

More Books

Students also viewed these Databases questions