Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*Write a program that computes the tax and tip on a restaurant bill for a patron based on what they ordered. -The tax should be

*Write a program that computes the tax and tip on a restaurant bill for a patron based on what they ordered. -The tax should be 6.75 percent of the meal cost, if the service was good the tip should be 20 percent of the total after adding the tax, if the service was poor the tip should be 15%.

Display the meal cost, tax amount, tip amount, and the total bill on the screen. Utilize at least one constant variable.* **Your program will be tested against different inputs. **

Suggestion: Complete each part one at a time to ensure at least some credit. Use at least one constant variable.*

(1) Ask the user for the price of the three items that they ordered. Output the total of the items. (Submit for 5 point).

What was the price of each of the items that you ordered? Item 1: $ [display your amount] Item 2: $ [display your amount] Item 3: $ [display your amount] Your items total: $ 

(2) Compute the tax owed on the meal and the new subtotal including tax. North Carolina's food tax is a rate of 6.75% (Submit for 5 points).

Item 1: $ [display your amount] Item 2: $ [display your amount] Item 3: $ [display your amount] Your items total: [display your amount] The tax owed on your bill is: $[display your amount] Your subtotal is now: $[display your amount] 

(3) Allow your user to determine the level of tip they would like to leave the user. Show them their final total with the tip included.

Item 1: $ [display your amount] Item 2: $ [display your amount] Item 3: $ [display your amount] Your items total: [display your amount] The tax owed on your bill is: $[display your amount] Your subtotal is now: $[display your amount] Input 'good' or 'poor' to determine the tip amount Your tip amount is: $[display your amount] Your new total is: $[display your amount] 

---------------

code:

int main() {

// Declare all necessary variables double subtotal; double tipamount; double total; double item1; double item2; double item3; double taxtotal; string tip; // Take in intial values & calculate subtotals cout << "What was the price of the items that you ordered? "; cout << "Item 1: $ "; cout << "The tax owed on your bill is: $" << taxtotal << endl; /* Type your code here. */ cout << "Your subtotal is now: $"<< total<< endl; cout << "Input 'good' or 'poor' to determine the tip amount" << endl; // Determine the percentage rate for the tip // Output the tip and final total amounts cout << "Your tip amount is: $" << tipamount << endl; cout << "Your new total is: $" << total;

return 0; }

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

Database Systems For Advanced Applications 27th International Conference Dasfaa 2022 Virtual Event April 11 14 2022 Proceedings Part 2 Lncs 13246

Authors: Arnab Bhattacharya ,Janice Lee Mong Li ,Divyakant Agrawal ,P. Krishna Reddy ,Mukesh Mohania ,Anirban Mondal ,Vikram Goyal ,Rage Uday Kiran

1st Edition

3031001257, 978-3031001253

More Books

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago