Answered step by step
Verified Expert Solution
Link Copied!

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!!

image text in transcribed

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 methods

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

Discuss different internal sources of HR data.

Answered: 1 week ago

Question

=+ Have they changed the way employers view IP?

Answered: 1 week ago