Assignment 3
Assignment 3
Assignment # 3
___________________________________________________
Garage Management
You are hired by a Garage owner to design a Garage Management System (GMS). To avoid the
Traffic jams, your GMS will tell the new customers coming to the garage at the garage entrance
how many places are left in the Garage and whether there is place for their car in the Garage or
not (You GMS will be also conveying this information to Garage owner as well). To design this
Garage Management System you will write two classes those are Car and Garage classes.
Details of the functionality desired by these classes is dictated by the GMS requirements. So
1 . Write a class named as Car having following Attributes:
2. Now write class Garage of your GMS having the following attributes
Write a constructor for class Garage to initialize its attributes. Initially consider that the Garage
has capacity of 1 0 cars.
IsEmpty(): Returns true if garage is empty and false otherwise
IsFull(): Returns true if garage is full and false otherwise.
Push(car c): Implement that function to park a new car c in garage, considering that the garage is
not full.
Find(string reg): Function should return true if that car is parked in garage and false otherwise
Remove(string reg): Function should remove the car object from garage having reg_no equals to
the given in the parameter. Returns true if car is successfully removed and false otherwise and
display messages accordingly.
(Hint: You can compare two strings using == equality operator in the same way you compare two
numerical variables)
Display(): Displays all the cars parked in garage currently.
v.
vi.
vii.
1.
2.
3.
4.
5.