I need help with some calculations for and if else statement

I have this program and i need to put in different calculations for it
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
// if else statement for the locations
	if(location >= 100 && location <= 199) 
	{
    
	}
	else if (location >= 200 && location <= 299) 
	{
    
	}
	else if (location >= 300 && location <= 399) 
	{
    
	}
	else if (location >= 400 && location <= 499) 
	{
    
	}
	else if (location >= 500 && location <= 599) 
	{
   
	}
	else 
	{
   
	}


This is what i have now for my else if statement

and this is the documentation that goes with it:
Locations 100-199 get paid $10.00 per hour with time and a half for any hours over 5 per day.
Locations 200-299 get paid $7.50 per hour with double time for hours worked over 6 per day.
Locations 300-399 get paid $9.25 for the first 4 hours and $10.50 for the rest.
Locations 400-499 get paid $13.50 per hour on Sundays (day 1) and Saturdays (day 7) and $6.75 per hour
otherwise.
Locations 500-599 get paid $8.00 per hour for the first 6 hours per day and $12.00 per hour after that.

That's the document that came with is or part of it
im have trouble of the calculations part of the program

This is all of my code that i have so far and i need help with the calculation part of the program:
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include <iomanip>
#include <iostream>

using namespace std;

int main()
{
	int location;
	char location01, day01, starting_time01, ending_time01;
	char location02, day02, starting_time02, ending_time02;
	char time;
	// int sum = 0, location, hoursWorked, extraHoursWorked, paidOverFive, hour, money, total, paid;

	// cout to let you enter stuff
	cout << "Enter the location, day number, starting time and ending time for day one: ";
	cin >> location01, day01, starting_time01, ending_time01;
	cout << endl;

	cout << "Enter the location, day number, starting time and ending time for day two: ";
	cin >> location02, day02, starting_time02, ending_time02;
	cout << endl;

	// switch statement for hours
	switch(time)
	{
	case '1':
		{
			return '9';
		}
		break;
	case '2':
		{
			return '9.5';
		}
		break;
	case '3':
		{
			return '10';
		}
		break;
	case '4':
		{
			return '10.5';
		}
		break;
	case '5':
		{
			return '11';
		}
		break;
	case '6':
		{
			return '11.5';
		}
		break; 
	case '7':
		{
			return '12';
		}
	case '8':
		{
			return '12.5';
		}
		break;
	case '9':
		{
			return '13';
		}
		break;
	case 'A':
		{
			return '13.5';
		}
		break;
	case 'B':
		{
			return '14';
		}
		break;
	case 'C':
		{
			return '14.5';
		}
		break;
	case 'D':
		{
			return '15';
		}
		break;
	case 'E':
		{
			return '15.5';
		}
		break;
	case 'F':
		{
			return '16';
		}
		break;
	case 'G':
		{
			return '16.5';
		}
		break;
	case 'H':
		{
			return '17';
		}
		break;
	default:break;
	}

	// if else statement for the locations
	if(location >= 100 && location <= 199) 
	{
    
	}
	else if (location >= 200 && location <= 299) 
	{
    
	}
	else if (location >= 300 && location <= 399) 
	{
    
	}
	else if (location >= 400 && location <= 499) 
	{
    
	}
	else if (location >= 500 && location <= 599) 
	{
   
	}
	else 
	{
   
	}


		



	return 0;
}


Heres the whole document that came with it:
PROBLEM: Most hourly jobs require someone to enter information on a time sheet. The ACSL Amusement
Park is open from 9:00 a.m. to 5:00 p.m. The Business Office enters a code representing the location where an
employee works and the starting time and ending time for each day. The codes entered are as follows:
9:00 = 1 9:30 = 2 10:00 = 3 10:30 = 4 11:00 = 5 11:30 = 6 12:00 = 7
12:30 = 8 1:00 = 9 1:30 = A 2:00 = B 2:30 = C 3:00 = D 3:30 = E
4:00 = F 4:30 = G 5:00 = H
Locations 100-199 get paid $10.00 per hour with time and a half for any hours over 5 per day.
Locations 200-299 get paid $7.50 per hour with double time for hours worked over 6 per day.
Locations 300-399 get paid $9.25 for the first 4 hours and $10.50 for the rest.
Locations 400-499 get paid $13.50 per hour on Sundays (day 1) and Saturdays (day 7) and $6.75 per hour
otherwise.
Locations 500-599 get paid $8.00 per hour for the first 6 hours per day and $12.00 per hour after that.
INPUT: There will be 5 lines of input. Each line will contain the employee information for 2 work days. The
data will represent in order the location, the day number, the start time and the end time for each day.
OUTPUT: The total amount of money that the employee gets paid for the two days printed as dollars and cents
rounded to the nearest cent.
SAMPLE INPUT: SAMPLE OUTPUT:
1. 125, 2, 1, 7, 125, 3, 5, H 1. $95.00
2. 214, 4, 1, H, 314, 5, 5, H 2. $133.00
3. 318, 1, 1, H, 319, 3, 3, D 3. $126.50
4. 423, 1, 1, 7, 500, 2, 5, H 4. $88.50
5. 529, 6, 1, G, 100, 4, 2, G 5. $146.00


That's all that i really have for now
And im wondering if any one can help me on the calculations part
thanks
Locations 100-199 get paid $10.00 per hour with time and a half for any hours over 5 per day.


Think about how you'd figure these out on paper for math.
Regular hours get regular pay rate.
Overtime hours get overtime pay rate.

Suppose a person in this location works 8 hours.
Regular hours are the first 5 worked.
Overtime hours are the actual hours less the regular hours, so 8-5=3.
Regular hours * regular payrate = regular pay.
Overtime hours * overtime pay rate = OT pay
Total pay = reg + OT

Suppose a person in this location works 4 hours.
Their time is within regular hours, so they have no overtime.

The exact details vary by location, but the basic structure is similar.


A couple of other things from the code - the comma operator doesn't work the way you may be expecting it to here. Use a >> in front of each variable.

cin >> location01, day01, starting_time01, ending_time01;


Is this going switch statement going to be in main or in a separate function? Main wouldn't return a char or string value.

1
2
3
4
5
6
switch(time)
	{
	case '1':
		{
			return '9';
		}



location is going to a number like 100? char is just a single character.
char location01
Topic archived. No new replies allowed.