Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Java application that calculates three options for an appropriate tip to leave after a meal at a restaurant. Specifications The application should calculate

Create a Java application that calculates three options for an appropriate tip to leave after a meal at a restaurant.

Specifications The application should calculate and display the cost of tipping at 15%, 20%, and 25%. Use rounding to make sure that all calculations are accurate. Assume that the user will enter a valid cost for the meal. Format the tip percent, the tip amount, and the total. The application should continue only if the user enters y or Y to continue.

Input A floating point number of the cost of the meal using a string prompt

Processing Calculate the 15%, 20%, and 25% of the cost of the meal. Calculate the total cost of the meal including tip.

Output Print Header (tip percentage amount). Print a line with the tip amount. Print a line with the total cost of the meal. Repeat for all tip percentages. Offer user another chance to enter another meal amount or to exit.

Console

Tip Calculator
Cost of meal: 52.31
15%
Tip amount: $7.85
Total amount: $60.16
20%
Tip amount:

$10.46

Total amount:

$62.77

25%
Tip amount: $13.08
Total amount: $65.39
Continue? (y/n): n

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_2

Step: 3

blur-text-image_3

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions