Create a program that lets you board people in an airplane. We’ve already prepared some things for you here so you don’t have to build everything from scratch. You are supposed to build the class Airplane
.
The following rules apply for this program:
Airplane
, but may not be changed after creating an Airplane instance.Bag
instances) that must also be carried on the plane. Each passenger takes 0-3 bags in which this weight is distributed. It is important that the plane does not exceed the maximum weight (what it can carry). This maximum is 25 kg * the number of passengers that fits in the plane. (So with 40 passengers on the plane, a maximum of 1000 kg of luggage can be carried).Now write the full implementation of the program, focusing on adding the following functionality:
lockDoors()
) and open (unlockDoors()
) the doors of an aircraft. Also, you should be able to query whether the doors are locked or not (hasLockedDoors()
)boardPassenger(Passenger passenger)
that allows you to seat a particular passenger on the plane.
IllegalStateException
should be thrown.
depart()
that allows you to make the plane leave.
It is important that software is well tested, so we ask you to think about which situations you need to test. Create an overview of tests that you need tot carry out and test all these situations.
When you are done with the manual testing you can uncomment all lines in the TestApplication
class and run these automatic test as well. They should all pass. If not, try to understand why the test fails and make sure to fix your code.