Errors with Xcode- help!

I have created this program which is supposed to give payroll for different positions. One problem I am having is the program should give a "TotalPay" when the user presses Q. I can't figure out how to write that in code.
My other problem is: I am using Xcode, and it has given me 2 errors "Unknown type name (little picture of a box)" and 2 errors "Expected ';' after top level declarator". Please help me find these 4 errors. I don't know what they mean. Thank you!


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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include <iostream>#include <iomanip> // for 'fixed' and 'setprecision'

using namespace std;

int main()// function main begins program execution
{
    int paycode,
        TotalHours,
        TotalPay,
        sales;
    double pay,
           HourlyPay,
           SalesComm,
           WeeklySalary,
           WeeklyPay,
           PayPerWidget,
           WidgetsSold,
           GrossWeeklySales;

    cout << "Enter pay code ([Q]uit):"
    cin >> paycode;
    
    cout << fixed << showpoint << setprecision(2);
    
    switch (paycode)
    {
        case 1:
            cout << "Manager selected." << endl;
            cout << "Enter weekly salary: ";
            cin >> WeeklySalary;
            cout << endl;
            
            pay = WeeklySalary;
            cout << "Managers pay is $" << pay;
            cout << endl;
            break;
            
        case 2:
            cout << "Hourly Worker selected." << endl;
            cout << "Enter the hourly pay:";
            cin >> HourlyPay;
            cout << endl;
            
            cout << "Enter the total hours worked:";
            cin >> TotalHours;
            
            if (TotalHours <= 40)
                pay = HourlyPay * TotalHours;
            else
                pay = (40 * HourlyPay) + (TotalHours - 40) * (HourlyPay * 1.5)
            
                cout << endl;
            cout << "Hourly Worker's pay is $" << pay;
            cout << endl;
            break;
            
        case 3:
            cout << "Commission Worker selected." << endl;
            cout << "Enter weekly salary:";
            cin >> WeeklyPay;
            cout << endl;
            
            cout << "Enter commission (%): ";
            cin >> SalesComm;
            cout << endl;
            
            cout << "Enter gross weekly sales:";
            cin >> GrossWeeklySales;
            cout << endl;
            
            pay = (SalesComm / 100) * GrossWeeklySales + WeeklyPay;
            cout << " Commission Worker's pay is $" << pay;
            cout << endl;
            break;
            
        case 4:
            cout << "Widget Worker selected." << endl;
            cout << "Enter pay per widget:";
            cin >> PayPerWidget;
            cout << endl;
            
            cout << "Enter number of widgets: ";
            cin >> WidgetsSold;
            cout << endl;
            
            pay = PayPerWidget * WidgetsSold;
            cout << "Widget Worker's pay is $" << pay;
            cout << endl;
            break;
   
       
            }
return 0;
            
            
    }
line 21: error: missing semi-colon
line 51: error: missing semi-colon, aka (as known as) ;
Ignore him.
If you are going to test to see if paycode is 'Q', you should make paycode a char and then change your case code to check for different letters for example:
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include <iostream>
#include <iomanip> // for 'fixed' and 'setprecision'
#include <cctype>  // for toupper

using namespace std;

int main()// function main begins program execution
{
	char paycode;
    int TotalHours,
        TotalPay,
        sales;
    double pay,
           HourlyPay,
           SalesComm,
           WeeklySalary,
           WeeklyPay,
           PayPerWidget,
           WidgetsSold,
           GrossWeeklySales;

    cout << "[M]anager\n"
		 << "[H]ourly Worker\n"
		 << "[C]ommission Worker\n"
		 << "[W]idget Worker\n"
		 << "[Q]uit\n"
		 << "Enter paycode: ";
    cin >> paycode;
    if (isalpha(paycode)){ // make sure paycode is a letter
		paycode = toupper(paycode); // make paycode caps 
	}else{
		cout << "Not a valid letter.\n";
	}
    
    cout << fixed << showpoint << setprecision(2);
    
    switch (paycode)
    {
        case 'M':
            cout << "Manager selected." << endl;
            cout << "Enter weekly salary: ";
            cin >> WeeklySalary;
            cout << endl;
            
            pay = WeeklySalary;
            cout << "Managers pay is $" << pay;
            cout << endl;
            break;
            
        case 'H':
            cout << "Hourly Worker selected." << endl;
            cout << "Enter the hourly pay:";
            cin >> HourlyPay;
            cout << endl;
            
            cout << "Enter the total hours worked:";
            cin >> TotalHours;
            
            if (TotalHours <= 40)
                pay = HourlyPay * TotalHours;
            else
                pay = (40 * HourlyPay) + (TotalHours - 40) * (HourlyPay * 1.5);
            
                cout << endl;
            cout << "Hourly Worker's pay is $" << pay;
            cout << endl;
            break;
            
        case 'C':
            cout << "Commission Worker selected." << endl;
            cout << "Enter weekly salary:";
            cin >> WeeklyPay;
            cout << endl;
            
            cout << "Enter commission (%): ";
            cin >> SalesComm;
            cout << endl;
            
            cout << "Enter gross weekly sales:";
            cin >> GrossWeeklySales;
            cout << endl;
            
            pay = (SalesComm / 100) * GrossWeeklySales + WeeklyPay;
            cout << " Commission Worker's pay is $" << pay;
            cout << endl;
            break;
            
        case 'W':
            cout << "Widget Worker selected." << endl;
            cout << "Enter pay per widget:";
            cin >> PayPerWidget;
            cout << endl;
            
            cout << "Enter number of widgets: ";
            cin >> WidgetsSold;
            cout << endl;
            
            pay = PayPerWidget * WidgetsSold;
            cout << "Widget Worker's pay is $" << pay;
            cout << endl;
            break;
        case 'Q':
			cout << "Good-bye!\n";
		break;      
		default:
			cout << "Sorry, character was not M, H, C, W, or Q.\n"
				 << "Terminating program!\n";
		break;
	}
	
	return 0;         
	
}
[M]anager
[H]ourly Worker
[C]ommission Worker
[W]idget Worker
[Q]uit
Enter paycode: d
Sorry, character was not M, H, C, W, or Q.
Terminating program!

[M]anager
[H]ourly Worker
[C]ommission Worker
[W]idget Worker
[Q]uit
Enter paycode: m
Manager selected.
Enter weekly salary: 
Last edited on
Topic archived. No new replies allowed.