Question
I need help with this code in C# for visual studio A multi-city flight is a combination of two connecting flights. Here are some constraints
I need help with this code in C# for visual studio
A multi-city flight is a combination of two connecting flights.
Here are some constraints to make your life easier:
Every flight lasts 4 hours.
You can only choose a connecting flight that leaves 1 hour or more after the arrival of the first flight.
A connecting flight must leave on the same date as the originating flight. All airports are in the same time zone.
All flight times and flight durations are to be displayed in 24-hour format, as 05:40 or 14:20.
For example, suppose the user selects a flight request to travel from MIA to SEA.
The following multi-city flights can be displayed because at least 5 hours pass between the departure time of the first flight and the departure time of the second flight:
MIA-LAX (09:00), followed by LAX-SEA (14:00)
MIA-LAX (09:00), followed by LAX-SEA (18:00)
MIA-LAX (13:00), followed by LAX-SEA (18:00)
MIA-LAX (13:00), followed by LAX-SEA (20:00)
MIA-LAX (15:00), followed by LAX-SEA (20:00)
MIA-DEN (10:00), followed by DEN-SEA (15:00)
MIA-DEN (10:00), followed by DEN-SEA (19:00)
MIA-DEN (14:00), followed by DEN-SEA (19:00)
MIA-DEN (14:00), followed by DEN-SEA (22:00)
MIA-DEN (17:00), followed by DEN-SEA (22:00)
But the following multi-city trips would not be displayed because the passenger would not be able to make the connection:
MIA-LAX (13:00), followed by LAX-SEA (14:00)
MIA-LAX (15:00), followed by LAX-SEA (18:00)
MIA-DEN (14:00), followed by DEN-SEA (15:00)
MIA-DEN (17:00), followed by DEN-SEA (19:00)
In a list box, you must display detailed information about each trip: For each flight, display the flight number, airport codes, and departure time. After the two flights, display the trip's total duration and cost.
How can I compare to meet these requirements so far I have these constraints implemented that will help:
there is only 3 time zones in my data, (4 airports: MIA, LAX, SEA, DEN)
time format I already have,
flight schedule will be the same each day
every flight is set to last 4 hours.
How can I implement Icompare or IEquatable, TimeSpan? Any help is appreciated!
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