Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C++ that computes the tax and tip on a restaurant bill for a patron based on what they ordered. Below are

Write a program in C++ that computes the tax and tip on a restaurant bill for a patron based on what they ordered. Below are some suggested steps to help you build the program.

Create an array that can store 10 elements (i.e. the prices of the items)

Create a loop that allows the array to be filled with a price each time the user inputs a new value

The loop will iterate as long as the user has items to add

The output will show the price of the current entered items and their subtotal as well as the tax

Once the user has no more items to enter ( they will input "no") 4 tip options will be displayed for them to choose from

The user will input a tip amount and their total amount will be calculated. See below for sample outputs

use a string for the input **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 first item that they ordered and compute the subtotal and tax on that item. (Submit for 5 point).

 What was the price of the item you ordered? Item 1: $10.99 Current subtotal: $10.99 Current tax: $0.741825 Do you have any other items? no 

(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).

 What was the price of the item you ordered? Item 1: $12.5 Current subtotal: $12.5 Current tax: $0.84375 Do you have any other items? yes What was the price of the item you ordered? Item 1: $12.5 Item 2: $0.99 Current subtotal: $13.49 Current tax: $0.910575 Do you have any other items? no 

(3) Once they have input all of their items 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.

What was the price of the item you ordered? Item 1: $3.5 Current subtotal: $3.5 Current tax: $0.23625 Do you have any other items? yes What was the price of the item you ordered? Item 1: $3.5 Item 2: $10.99 Current subtotal: $14.49 Current tax: $0.978075 Do you have any other items? yes What was the price of the item you ordered? Item 1: $3.5 Item 2: $10.99 Item 3: $2.5 Current subtotal: $16.99 Current tax: $1.14683 Do you have any other items? no Your tip options are: 10%: $1.699 15%: $2.5485 18%: $3.0582 20%: $3.398 Select your tip percentage (only the number): 10 Your total is: $19.8358 

GIVEN CODE:

#include using namespace std;

int main() {

// Declare all necessary variables //don't forget to use at least 1 constant // Take in intial values & calculate subtotals after each item is input cout << "What was the price of the item you ordered? "; cout << "Current subtotal: $" ; cout << "Current tax: $" ; cout << "Do you have any other items?"; // should be a string response // Determine the percentage rate for the tip cout<< "Your tip options are: "; cout << "Select your tip percentage (only the number): "; // Output the final total amount includeing tip 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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

Strengthen your personal presence.

Answered: 1 week ago

Question

(1 point) Calculate 3 sin x cos x dx.

Answered: 1 week ago