Question: 17.3: Calculating The Bill [(JAVA, ECLIPSE), Please keep the program as short as possible] Write a program to help you calculate your bill at a

17.3: Calculating The Bill

[(JAVA, ECLIPSE), Please keep the program as short as possible]

  • Write a program to help you calculate your bill at a pizza restaurant.
  • Name your program Bill.java
  • For this program, you will need to write 4 methods, as follows:

calculateBill

  • Takes in a double parameter for the price of the food.
  • calls the addTax method to add taxes to the price.
  • calls the calculateTip method to add the tip to the price.
  • calls the formatPrice method to print out the price
  • returns nothing

addTax

  • Takes in a double parameter for the price of the food.
  • adds the tax onto the the total price, assuming the tax rate is 8.5%
  • returns the update price

calculateTip

  • Takes in a double parameter for the current bill (price of food + tax).
  • adds the tip onto the the total price, assuming a tip of 15%
  • returns the updated price

formatPrice

  • Takes in a double parameter for the price.
  • prints the price in the form $X.XX
  • (Hint: How do you get the price to have only 2 decimal values?)
  • Also prints a message about the final price: "With tax and tip, your total comes to $"
  • returns nothing

Additional Specifications

  • Each method must also have a full Javadoc comment in the style described in class.
  • Important: You should call the calculateBill method inside of main, not the other three methods.
  • The other 3 methods should be called inside of the calculateBill method.
  • Note that calculateTip will work very similarly to the addTax method

Sample Output

  • Your program should work identically to the following:

Welcome to Mama Domino's Pizzaria!

Enter the price of the pizza: 12.99

With taxes and tip, your total comes to $16.21

  • When you are finished, upload your program to Canvas.

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!