help on an assignment

closed account (y7p9z8AR)
Hi i need help on an assignment im taking. my professor said :

You are to create a program for a restaurant.

Your program will only capture the meal subtotal ( which is the amount before taxes and tip) and the size of the party.

Your program will need to calculate the tax and tip based on the subtotal entered by the user. Each calculation needs to be made on a different function.

The tax function will only receive the subtotal of the meal and return the tax calculation. You are to use 8.25% for tax. Example: if the subtotal was 100.00 the tax function needs to return 8.25

The function for the tip will receive the subtotal amount (before taxes) and the number of the party. You will calculate the tip based on the size of the party. If the party is less than 6, then the tip is to be calculated as 15%. If the party is 6 or more then the tip is to be calculated as 20%.

After the above information is entered by the user your program should display a breakdown as demonstrated below. In addition, your program needs to loop if the user decides that they want to enter new information.

im not quite sure how to even begin with this assignment or how to do it. plz help?
Start working on it, do what you know. When you get stuck come with code. You have to make an attempt.
Last edited on
Write some pseudo code :+)

Start out very general, then go back and refine until you are happy to convert to code.

Edit:

Doing multiple posts won't help you to get extra answers - more likely a turn off for those who might reply. It's a time waster.
Last edited on
closed account (y7p9z8AR)
okay i have a program for it. i just have one problem.

#include<iostream>

using namespace std;

double taxes(double subtotal){
return 0.825 * subtotal;
}

double tip(double subtotal, int number){
if(number < 6)
return 0.15 * subtotal;
else
return 0.2 * subtotal;
}

int main () {

while (1) {

double subtotal;
int number;

cout << "Please enter subtotal : ";
cin >> subtotal;

cout << "Please enter number of people : ";
cin >> number;

cout << "The meal is : " << subtotal << endl;

cout << "The taxes are : " << taxes(subtotal) << endl;

cout << "The tip is : " << tip(subtotal, number) << endl;

char choice;
cout << "Do you want to enter new information? (Y/N)";
cin >> choice;

if(choice == 'n' or choice == 'N')
break;
}

return 0;
}

The tax at the end is 82.5 when it should be 8.25.
return 0.825 * subtotal;

maybe return 0.0825 * subtotal?

0.825 is 82.5 %
0.0825 is 8.25%
closed account (y7p9z8AR)
Thanks chicofeo for the help. very much appreciated.
Topic archived. No new replies allowed.