This week you are going to simulate a domain of airports and aircraft.
An airport has only two attributes: wind speed (mph) and runway length (feet).
There are three kinds of aircraft: planes, helicopters and shuttles. All aircraft have a weight (int), an ID (string), and a member function bool canLand(Airport *ap) that returns whether the aircraft can land at a given airport.
A plane can land at an airport if there is at least one foot of runway for every 25 pounds of its weight, andthe wind speed does not exceed 30 mph.
A helicopter can land at an airport if the wind speed does not exceed 20 mph.
A shuttle can land at an airport if the runway length, in feet, is greater than one thousand times the wind speed, in mph. All shuttles weigh 200,000.
airport | runway length | wind speed |
---|---|---|
1 | 10,000 | 15 |
2 | 30,000 | 25 |
3 | 50,000 | 40 |
and another array of pointers to six aircraft. The aircraft objects should be dynamically created.
aircraft | type | weight | id |
---|---|---|---|
1 | plane | 100,000 | P100 |
2 | helicopter | 25,000 | H100 |
3 | plane | 500,000 | P200 |
4 | helicopter | 30,000 | H200 |
5 | shuttle | 200,000 | S100 |
6 | shuttle | 200,000 | S200 |
Of course, all your output should be beautifully organized and labeled.
Turn in your program in the usual way, as described in Instructions for Handing in Assignments.