Question
Create a Java class called ResturantBill. An object from this class should have five instance variables: Name of the restaurant, Cost,Tax,Tip,and Total Cost. The name
Create a Java class called ResturantBill. An object from this class should have five instance variables: Name of the restaurant, Cost,Tax,Tip,and Total Cost. The name of the restaurant and cost of the bill(before tax and tip) will be assigned a value that the user will pass into the constructor. The tax,tip,and total cost will start with the value of 0. You will need to create get methods for each of your indtance variables.You will also need the following methods:
Method that calculates tax amount assuming 7% tax(no parameters needed).
Method that calculates the tip amount . This method will accept a String parameter that will represent whether the person was Totally Satisfied,Satisfied or Dissatisfied. The tip will be 20%,15%,or 10% respectively.
Method that calculates the total cost of the bill(no parameters needed).
Method that returns the cost, tax amount,tip and total cost properly formatted.
Your Tester program should ask the user what resturant they ate at and how much the original cost of the meal was. When you create the resturant bill object you should use the variables input by the user as the parameters for the constructor. Once you have created the object you should call all necessary methods to calculate the total cost of the bill. You should print out all of the costs that make up the total blii for the user to see.(For the tip calculator method you will have to ask the user if they were totally satisfied/satisfied/dissatisfied, save this in a variable, and pass that variable as the parameter to the method
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started