Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this is in Java!! 3) (40 pts) Your last task is to implement a simple BusGarage class in Java to represent the presence of a
this is in Java!!
3) (40 pts) Your last task is to implement a simple BusGarage class in Java to represent the presence of a quantity of identical buses within a storage facility (garage). It must have the following variables and methods: int currentBusCount: how many buses a given garage currently holds int maxBusCapacity: the maximum number of buses a given garage can hold BusGarage(int maxCount): Constructor that initializes the maxBusCapacity of a new garage equal to maxCount and sets the garage to be initially empty. departure(): A simple method that removes a single bus from a garage. Will only apply the change if the garage is not empty. Otherwise a message should be printed that the garage is empty and the addition is to be ignored. arrival(): Mirrors the departure method but instead adds a single bus to a garage. In this case, the change will only be applied if the resulting count does not exceed the garage's max capacity. If it does, a message that the garage is full should be printed instead. toString(): Should display the garage's current bus count and max capacity in a user-friendly format (e.g. This garage currently holds 10 of a max 20 buses.") Note: you can assume only positive integers will be used in the above methodsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started