v# Airport Challenge
As an air traffic controller
So I can get passengers to a destination
I want to instruct the airport to land a plane
Objects | Properties | Messages | Outputs |
---|---|---|---|
Plane | id @str | ||
Airport | id @str | landPlane() |
Initial thoughts:
- I need an airport to land a plane
- I need to be able to send a message to tell the airport to allow a plane to land
- I need to tell it which plane is landing
As the system designer.
So that the software can be used for many different airports
I would like a default airport capacity that can be overridden as appropriate
Objects | Properties | Messages | Outputs |
---|---|---|---|
Airport | capacity @int | changeCapacity(@int) | @void |
Initial thoughts:
- Does the airport have a default capacity?
- Can I change this capacity?
- Need to ensure that capacity is only changed to a valid number.
As an air traffic controller
To ensure safety
I want to prevent landing when the airport is full
Objects | Properties | Messages | Outputs |
---|---|---|---|
Airport | capacity @int | isFull() | @bool |
Initial thoughts:
- If the number of planes in planesLanded is equal to capacity the plane cannot land
- If the capacity has not been reached it should allow a plane to be added.
- I may not actually need a function for this since it will not be reused.
As an air traffic controller
So I can get passengers on the way to their destination
I want to instruct the airport to let a plane take off and confirm that it is no longer in the airport
Objects | Properties | Messages | Outputs |
---|---|---|---|
Airport | takeOff(@Plane) | @str | |
Plane | id @str | takeOff() | |
inAir @bool | getAirStatus(@Plane) |
Initial thoughts
- Planes will need an ID.
- Need a function to remove them from the landed list.
- Only remove planes that exist on the list.
- need a search on planesLanded to confirm a plane isn't there
- Show a message to confirm this.
As an air traffic controller
To avoid confusion
I want to prevent asking the airport to let planes take off which are not at the airport, or land a plane which has already landed
Objects | Properties | Messages | Outputs |
---|---|---|---|
Airport | planesOnGround @array[@Plane] | @str | |
id @str | |||
Plane | id @str |
Removing some repeated functionality:
Objects | Properties | Messages | Outputs |
---|---|---|---|
Airport | capacity @int | isFull() | @bool |
planesOnGround @Array[@Plane] | takeOff(@Plane) | ||
landPlane(@Plane) | @str | ||
Plane | id @str | landPlane() |
As an air traffic controller
To ensure safety
I want to prevent takeoff when weather is stormy
As above, plus:
Objects | Properties | Messages | Outputs |
---|---|---|---|
Weather | isItStormy() | @bool | |
Airport | isItStormy() | weather.isItStormy() |
As an air traffic controller
To ensure safety
I want to prevent landing when weather is stormy
I can resuse the functionality added above to create this, no new objects needed.
As an air traffic controller
To count planes easily
Planes that have landed must be at an airport
This adds a property of 'airport' to the plane, so that the plane knows which airport it is at, as well as the airport knowing which planes it contains.
Objects | Properties | Messages | Outputs |
---|---|---|---|
Plane | airport @str | getAirport() | @str |
setAirport(@Airport) |