- Coach / Bus
- Create class Coach, which includes following functions:
- void PassengersIn(int iCount); // Increases amount of passengers.
- void PassengersOut(int iCount); // Decreases amount of passengers.
- int PassengerCount(); // Returns the amount of passengers.
- int CountFreeSeats(); // Returns the amount X of vacant places.
- int CountAllSeats(); // Returns the full amount Y of all places.
- The amount of seats and standing places are given to the constructor of
coach. Coach can not hold any more passengers than there are seats and
standing places. Passenger count can not be negative either.
- To test the class, create main() method/loop which manages the coach.
For testing it might be good idea to print the inputs and outputs / results
of each function using System.out.println( xxx ) method.
- Back