Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need help with this code for this project i got 6 errors aak: Create a new Java project or repl titled either Tipping_FirstName__astName or

i need help with this code for this project i got 6 errors image text in transcribed
image text in transcribed
aak: Create a new Java project or repl titled either Tipping_FirstName__astName or ab4_FirstName_LastName. You must include comments describing key parts of this program. 1. Make sure the initial code of your application is prepared to write statements in the main method. 2. Declare a Scanner that accepts input from the keyboard. 3. Declare the following two variables and one constant: - A variable of type double that will hold the cost of the meal - A variable of type int that will hold the user's selection for the amount to tip - A constant of type double that will hold a sales tax of 8.25% (as a decimal) 4. Include a prompt to the user to input the initial cost of the meal (before sales tax or tip). Use the appropriate method of the Scanner class to assign the user's input to the appropriate variable. 5. Calculate the cost of the meal with the sales tax applied and assign the result back to the same variable that holds the cost of the meal. 6. Include a second prompt to the user to input their choice of how much to tip. Use the appropriate method of the Scanner class to assign the user's input to the appropriate variable. 7. Use if statements to check which option the user chose. - If the user chose option 1 , apply a 10% tip and assign the result back to the same variable that holds the cost of the meal. - If the user chose option 2, apply a 15% tip and assign the result back to the same variable that holds the cost of the meal. - If the user chose option 3 , apply a 20% tip and assign the result back to the same variable that holds the cost of the meal. 8. Display the final cost to the user rounded to two decimal places. You must use the cast operator and appropriate math operations to round to two decimal places. The following are three different program flows for this program if the user enters 9.99 for the initial cost of the meal and chooses options 1,2 , or 3 , respectively. Please enter the initial cost of the meal: 9.99 Please enter your choice for the tip (1=104,2=15%,3=208):1 The final cost of the meal is $11.9 Please enter the initial cost of the meal: 9.99 Please enter your choice for the tip (1=108,2=158,3=208):2 The final cost of the meal is $12.44 Please enter the initial cost of the meal: 9.99 Please enter your cholce for the tip (1=108,2=158,3=208):3 The final cost of the meal is $12.98

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

More Books

Students also viewed these Databases questions

Question

Identify the different types of proposals.

Answered: 1 week ago

Question

Question Can a self-employed person adopt a profit sharing plan?

Answered: 1 week ago