Exactly 700 student interviews were conducted
with the information being placed in a file named studentsurvey.txt
Each line of this file contains a student's age, grade point average (GPA),
number of credits being carried, a 3- or 4-letter designator of the student's
major and seven indicators as to what the student was doing each night
of the survey week at 9 pm. The indicators are in order, representing
the nights of Sunday through Saturday). The indicators consist of
2-letter codes, as follows
| Code | What it represents |
| TV | Watching a Television Channel |
| ST | Studying |
| MU | Listening to Music |
| VG | Playing Video Games |
| SO | Socializing with other students |
| PH | Talking on the telephone |
| MV | Watching a Movie (theater or TV) |
| CU | Computer Use |
| DR | Drinking |
| OT | Other |
| FG | Student has forgotten what s/he did |
Only traditional college students were surveyed; thus, the ages are limited to between 18 and 23 years old. Also, only full-time students were surveyed; thus, the number of credits they were taking ranged between 12 and 19. There is no particular order to the data in the studentsurvey.txt file. Below are the first few lines of the file
22 3.49 14 MIS DR TV ST CU TV SO FG
22 3.87 17 GEOS TV FG TV MU TV MV FG
20 1.82 16 COMM VG OT PH DR SO CU ST
21 2.71 16 CRIM ST MU ST TV DR DR FG
20 1.90 16 SPAN OT SO MU OT MU VG FG
You are to write a C++ program that reads the studentsurvey.txt file and produces two reports about what the students were doing at 9 pm on whatever night of the week the person running the program selects. That is, the program should prompt for a day name and expect the person at the keyboard to enter "Sunday, Monday, . . . or some other day" and then display the two reports. These reports are often referred to as cross-tabulations. One report is to show the number of students by credit load and 9 pm activity - so that we can see how many students with a 12-credit load were watching TV, studying, listening to music, etc. (and the same for 13-credit loads, 14-credit loads, etc.). The other report is to show the number of students by GPA group and 9 pm activity. The GPA groups are for GPAs less than 2.0, >= 2.0 and < 2.5, >= 2.5 and < 3.0, >=3.0 and < 3.5, and >= 3.5. Thus, we can see how many students with a GPA < 2.0 were talking on the phone, using a computer, drinking, etc. (and similarly for the other GPA groups). Below is a sample of the output for Wednesday activity.
Which day? Wednesday
9 pm Activities by Number of Credits Taken
Credits ST MU TV
VG CU MV PH SO
DR OT FG Total
12 7
3 8 6 9
8 2 9 3
2 11 68
13 14 6
11 8 7 4
5 10 1 3
9 78
14 12 6
6 11 8 8
3 5 5 7
10 81
15 26 16
22 26 8 7 11
16 6 9 16
163
16 21 11
24 18 19 16 11
12 5 6 18
161
17 14 7
24 11 9 6
6 5 1 2
17 102
18 2
1 4 5 3
1 2 1 1
0 1 21
19 6
2 2 4 1
2 2 3 0
2 2 26
Totals 102 52 101 89
64 52 42 61 22
31 84
9 pm Activities by GPA ranges
GPA range ST MU TV
VG CU MV PH SO
DR OT FG Total
[0,2.0) 8 7
12 8 11 7
8 6 6 8
11 92
[2.0,2.5) 21 9 17
27 12 12 4 14
4 9 19 148
[2.5,3.0) 16 11 31
15 8 11 11 18
10 8 23 162
[3.0,3.5) 27 12 21
17 14 13 11 12
2 4 21 154
[3.5,4.0] 30 13 20
22 19 9 8 11
0 2 10 144
Totals 102 52 101
89 64 52 42 61
22 31 84
Your program should be designed so that the person at the keyboard may enter any day of the week and get a listing for that day; then the program should prompt for another day. When the person at the keyboard enters "end", the program should quit. Your program MUST use at least one 2-dimensional array or an array of structs or both.
You can get your copy of studentsurvey.txt from the jlwolfe\110 folder on the I: drive. Hand in a printout of your program and a printout of the complete results if the person at the keyboard enters Tuesday as the day of the week and then enters Saturday as the day of the week. Name your .cpp file after yourself (as in yourname.cpp) and copy it to the hand-in folder for the course on the P: drive.
For extra credit:
1. Show a table of student age vs
9 pm activity similar to the two that you are required to produce.
This is fairly easy to do.
2. Show a table of major vs 9 pm
activity similar to the two that are required to produce. This is
fairly difficult to do.