Question
*Please read the question carefully to the end to give complete answer and also put in comments so that I can follow and understand (also
*Please read the question carefully to the end to give complete answer and also put in comments so that I can follow and understand (also don't use other answer from Chegg website please!!). Thank you
Write a small program that implements a parking lot manager in Java. Your program should implement the
following classes:
Car:
Contains a string for make, model, and color. It also contains a boolean representing
whether this car has handicap accessible parking.
Implements a constructor that takes the aforementioned five instance variables.
ParkingSpot:
Contains an instance of Car describing the car currently parked in this spot.
Contains a boolean variable handicap, set to true if the spot is handicap accessible.
Implements a constructor that takes the aforementioned boolean.
ParkingLot:
Contains an array of twenty ParkingSpots, four of which must be handicap accessible.
Implements a constructor that creates the aforementioned array.
Implements a method that takes a Car and parks it in an appropriate available parking spot.
This method should return an int representing the chosen index of the chosen parking spot in
the array. This method should also return -1 if no parking spot is free.
Implements a method that takes an int and removes and returns the specified Car from the
given Parking Spot.
Implement and override toString() to return a string containing the number of handicap
accessible and standard parking spots available separated by a single space (NN NN)
ParkingTester:
Contains only a main class that performs the following operations:
Instantiate a ParkingLot
Print the ParkingLot by calling its ToString() method
Instantiate a Car that represents a Blue Lexus RX, with handicap accessible tags
Park this Car in the ParkingLot
Print the ParkingLot by calling its ToString() method
Instantiate a Car entirely of your own design, you may choose handicap or non-handicap
Park this Car in the ParkingLot
Print the ParkingLot by calling its ToString() method
Remove the first Car (the Blue Lexus RX) from the ParkingLot
Print the ParkingLot by calling its ToString() method
Add fifteen cars of your own design (they can all be the same car) to the ParkingLot. You
must use a loop for this!
Print the ParkingLot by calling its ToString() method
Step 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