Question
Need some help with this assignment, using iostream library. Any help?? The .txt file that needs to be used for this assignment has been copied
Need some help with this assignment, using iostream library. Any help?? The .txt file that needs to be used for this assignment has been copied and pasted below the assignment...
~~~ schedules.txt ~~~
15
1
5 0 24
2
6 13 17
6 11 14
10
0 8 12
1. 8 12
2. 8 12
3. 8 12
4. 8 12
5. 8 12
6. 8 12
7. 12 15
8. 20 22
9. 18 20
3
1. 13 18
2. 8 17
1. 17 20
29
1. 2 5
1. 21 24
1. 5 17
1. 18 21
2. 1 9
3. 20 22
4. 17 19
5. 9 17
6. 0 10
7. 10 20
8. 20 22
9. 22 24
10. 5 10
11. 1 3
12. 4 5
13. 3 4
14. 10 20
15. 0 9
16. 21 22
17. 23 24
18. 2 3
19. 4 5
20. 5 6
21. 6 24
0 23 24
0 21 22
0 10 18
0 5 10
0 1 4
29
1. 2 5
1. 21 24
1. 5 17
1. 18 21
2. 1 9
3. 20 22
4. 17 19
5. 9 17
6. 0 10
7. 10 20
8. 20 22
9. 22 24
10. 5 10
11. 1 3
12. 4 5
13. 3 4
14. 10 20
15. 0 9
16. 21 22
17. 23 24
18. 2 3
19. 4 5
20. 5 6
21. 6 24
0 23 24
0 21 22
0 10 18
0 1 10
0 3 4
7
22. 0 24
1. 0 24
3 0 24
6 0 24
0 0 24
2. 0 24
4 0 24
8
5 0 24
1. 0 24
3 0 24
6 0 24
0 0 24
4 16 17
2. 0 24
4 0 24
10
6 17 20
5 22 23
4 8 12
3. 3 24
4. 1 19
1. 4 5
0 20 24
5 17 20
2. 10 11
4 13 17
10
6 17 20
5 22 23
4 8 12
3. 3 24
4. 1 19
1. 4 5
0 20 24
5 17 20
2. 20 22
4 3 17
7
5 2 20
6 1 15
5 3 17
6 14 24
5 4 23
5 20 22
6 15 20
8
5 1 5
5 2 6
5 3 7
5 4 24
5 5 8
5 6 20
5 7 24
5 8 9
8
5 3 7
5 1 5
5 2 6
5 4 24
5 5 8
5 6 20
5 7 24
5 8 9
3
4 22 23
4 1 2
4 0 24
3
1. 0 24
1. 21 22
1. 2 3
Since Arup enjoys many different activities, he often overbooks himself. In the past, this wasn't a problem. Either he would simply go to parts of two events that coincided, or he'd simply call the person hosting one of the two events telling them he couldn't make it. Normally, this didn't cause a problem because none of his appointments were ones that he absolutely had to keep. But now that he's getting married, his fiance occasionally has very important tasks for him that he can't simply call to get out of, if he has double- booked. In this problem you will help Arup identify schedules that contain double booking and schedules that don't. Though this problem can be solved in many ways, you'll be asked to solve it in a specific manner. You'll be given a set of responsibilities/events Arup has over the course of a week. Your goal will simply be to determine if there are any overlapping events at all. In particular, you'll be given several weekly schedules. Each weekly schedule will be a list of events. Each listing of events will contain the day (0 6, where Sunday = 0, Saturday = 6), a start hour (0 23, where 0 is midnight, 23 is 11 pm), and an end hour (1 24, where 1 is lam and 24 is midnight of the following day.) It is guaranteed that the end hour is greater than the start hour, so each event has a duration that is a positive integer number of hours. Restrictions for Solution In order to solve this problem, use an integer array of size 168 (the number of hours in a week). Each slot in the array stands for one hour in the week. Assume that the week starts on Sunday. Thus, indexes 0 through 23 represent the 24 hours on Sunday. For example, it to 1 am and index 20 represents 8pm through 9pm. Similarly. indexes 24 through 47 represent Monday. The array should store all Os (false) to indicate that the entire schedule is free before any of the data is read in. When you read in each event for the week, you must go to the appropriate slots in the array for that time period and see IF they are already scheduled, which would indicate a conflict. If they are, you know a conflict exists. If not, set each of these indexes to 1 (true) to indicate that the time period is now taken. For example, if an event runs from 5pm - 8pm on Tuesday, then indexes 65, 66 and 67 should be set to 1. Input Specification (schedule.txt) The first line of the input file will contain a single positive integer, n, representing the number of schedules in the input file to check. The schedules will follow. The first line of each schedule will contain a positive integer, E (
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started