Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a small program that implements a parking lot manager. Your program should implement the following classes: Car: Contains two strings for make and manufacturer

Write a small program that implements a parking lot manager. Your program should implement the
following classes:
Car:
Contains two strings for make and manufacturer. 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 ten ParkingSpots, two 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.
Implements a method that takes an int and removes and returns the specified Car from the
given Parking Spot.
Implement toString() to return a string containing the number of handicap accessible and
standard parking spots available separated by a single space (X Y)
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 Infiniti A, with handicap accessible tags
Park this Car in the ParkingLot
Print the ParkingLot by calling its ToString() method
Instantiate a Car entirely that represents a Cadiliac B, non-handicap
Park this Car in the ParkingLot
Print the ParkingLot by calling its ToString() method
Remove the first Car (the Infiniti A) from the ParkingLot
Print the ParkingLot by calling its ToString() method
Your output should appear in the console, and look like the following:
28
18
17
27

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_2

Step: 3

blur-text-image_3

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

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions

Question

Can atoms of different elements have the same number of neutrons?

Answered: 1 week ago

Question

6. Conclude with the same strength as in the introduction

Answered: 1 week ago

Question

7. Prepare an effective outline

Answered: 1 week ago