Help with Function Program

I need to write a program that acts as a menu and a cash register. i have figured out the menu part and for most part the cash register.

All i need to do now is have the program display "You Receive a Free Pickle" but only if the user enters large drink and sandwich or regular drink and sandwich.

I also need to ask the user if they are a teacher and if yes they receive a 20% discount.

I also need to know how to subtract the teacher's discount from the total.

Also i must display what the person ordered at the end of their order.

Here is what i have so far:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

const float TAX=.06;

void menu();


int main()
{
  float total=0;
  bool done=false;
  char choice;
  cout << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << setprecision(2);
  while (!done) 
  {
	menu();
	cout << "Welcome To Andrew's Overpriced Snack Bar!" <<endl;
	cout << endl;
    cout << "Your current sub-total is: $" << total << endl;
	cout << "Enter your selection (q to quit, ? for menu): ";
    cin >> choice;
	cout << endl;
    switch (choice) {
      case '?':
        menu();
        break;
      case 'S': case 's':
        cout << "Sandwitch, $12.50" << endl << endl;
        total+=12.5;
        break;
      case 'C': case 'c':
        cout << "Chips, $3.75" << endl << endl;
        total+=3.75;
        break;
      case 'B': case 'b':
        cout << "Brownie, $4.25" << endl << endl;
        total+=4.25;
        break;
      case 'R': case 'r':
        cout << "Regular drink, $3.50" << endl << endl;
        total+=3.5;
        break;
      case 'L': case 'l':
        cout << "Large drink, $5.75" << endl << endl;
        total+=5.75;
        break;
      case 'X': case 'x':
        cout << "Cancel, start over." << endl << endl;
        total=0;
        break;
      case 'T': case 't':
        cout << "Sub-total: " << total << endl;
        cout << "+ Tax    : " << total*TAX << endl;
        cout << "Total    : " << total+total*TAX << endl << endl;
        break;
      case 'Q': case 'q':
        done=true;
        break;
      default:
        menu();
    }
  }
}

void menu() 
{
  cout << "Here is our menu" << endl;
  cout << "S - Sandwich $12.50" << endl;
  cout << "C - Chips $3.75" << endl;
  cout << "B - Brownie $4.25" << endl;
  cout << "R - Regular drink $3.50" << endl;
  cout << "L - Large drink $5.75" << endl;
  cout << "X - cancel and start over" << endl;
  cout << "T - total the sale" << endl;
  cout << endl;
  cout << "All items are subject to sales tax at 6%";
  cout << endl << endl;
}
Topic archived. No new replies allowed.