Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Write a program to check an input year is leap or not.

Answered: 1 week ago

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago