Question: In a scheduling program, we want to check whether two appointments overlap. For simplicity, appointments start at a full hour, and we use military time

In a scheduling program, we want to check whether two appointments overlap. For simplicity, appointments start at a full hour, and we use military time (with hours 023). The following pseudocode describes an algorithm that determines whether the appointment with start time start1 and end time end1 overlaps with the appointment with start time start2 and end time end2 in python code.
If start1> start2
s = start1
Else
s = start2
If end1< end2
e = end1
Else
e = end2
If s < e
The appointments overlap.
Else
The appointments dont overlap.
Here is a sample run
Please enter the first appointment start time: 10
Please enter the first appointment end time: 12
Please enter the second appointment start time: 11
Please enter the second appointment end time: 13
The appointments overlap
Please enter the first appointment start time: 10
Please enter the first appointment end time: 11
Please enter the second appointment start time: 12
Please enter the second appointment end time: 13
The appointments dont overlap
Please enter the first appointment start time: 70
Please enter the first appointment end time: 12
Please enter the second appointment start time: 11
Please enter the second appointment end time: 13
Invalid time(s)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!