0

Maybe this is a bit off topic, but it's used in programming (the class is introduction to programming, using only algorithms and no computer programs).

This is the problem:

"An airline has three airplanes, each with a capacity of 100 passengers. The company has three routes, each flies once a day. (Route1, Route2, Route3).

It's company policy to cancel a flight when: -Number of booked passengers is lower than 20% of the plane's capacity.

Elaborate an algorithm that finds the following:

-Number of passengers per flight
-Routes to which the flight arrived.
-Number of cancelled flights

The file contains route, and number of passengers booked."

So I'm assuming this has something to do with a database algorithm, reading until EoF and all that, but I can't seem to do it.

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Infarction
0

Seems like you'd so something like this:
- Read a line. I'm assuming this'll have the route and the number of passengers. An alternate format might be a route on one line and the passengers on the next.
- Determine if the flight was canceled.
- Update any statistics you're storing.
- Repeat until EOF.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.