Time

The Time class stores two integers representing the starting time of an activity and the ending time of an activity in a PE lesson.

For example, if an activity starts at 13:17 and finishes at 13:25, the values 17 and 25 are stored.

The start number can never be less than 0 and the end number can never be greater than 60.

A Time object can be constructed as follows:

t = Time(17,25)

Task 1 - Class design

Design the Time class, including accessor methods for both the start and end properties.

Test you design by writing a program that constructs a Time object and displays the start and end time stored.

Note: you do not have to write validation code. We will do that in Task 2.

Save your solution as time-1.py

Task 2 - Validation

Write a program that will use the following information to construct 5 time objects and append them into an array with global scope.

The array should have a lower bound of 0 and an upper bound of 4 when complete.

When the user is entering the data, include validation techniques that will not allow the user to enter data that is less than 0 or greater than 60.

activity start end
1 0 13
2 15 19
3 23 31
4 37 43
5 49 56

Save your solution as time-2.py

Task 3 - Adaptive maintenance

In your program, implement a function that calculates and returns the total time of all activities in the global array of Time objects.

For example, using the above data, the function should return (13-0) + (19-15) + (31-23) + (43-27) + (56-49) = 48

Save your solution as time-3.py

Task 4 - Pseudocode

Write pseudocode, including the function header for your solution to Task 3.

Testing

Make sure you are thoughtful when testing your solution.

If your code has a validation check, test your code with acceptable/valid data and unacceptable/invalid data.