0% found this document useful (0 votes)
83 views

Assignment 3

The document describes an assignment to design a Garage Management System (GMS) with two classes: Car and Garage. The Car class has attributes for a car's make, model, registration number, color, and year, with constructor and initialization functions. The Garage class has attributes for its name, index, and capacity, storing an array of Car objects. It has functions to check if empty/full, add/remove cars, find a car, and display parked cars. The program menu allows users to add, remove, and find cars or check the garage capacity.

Uploaded by

Fahad Mahmood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

Assignment 3

The document describes an assignment to design a Garage Management System (GMS) with two classes: Car and Garage. The Car class has attributes for a car's make, model, registration number, color, and year, with constructor and initialization functions. The Garage class has attributes for its name, index, and capacity, storing an array of Car objects. It has functions to check if empty/full, add/remove cars, find a car, and display parked cars. The program menu allows users to add, remove, and find cars or check the garage capacity.

Uploaded by

Fahad Mahmood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Object Oriented Programming (Fall 2016)

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:

make of type string


car_model of type string
reg_no of type string
color of type string
year of type int

Car Class will provide following interface.


i.
ii.
iii.

Write a constructor to initialize the attributes of car.


Write init (string ,string, string, string, int ) function to initialize the attributes of car.
Write a destructor for car class

2. Now write class Garage of your GMS having the following attributes

name of type string


index of type int
capacity of type int
Array of objects of car class with maximum size equals to capacity

Provide following functionality/interface for Garage class


i.
ii.
iii.

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.

Object Oriented Programming (Fall 2016)


Assignment # 3
___________________________________________________
iv.

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.

3. Menu should looks like as follows:

1.
2.
3.
4.
5.

Add Car in Garage


Remove car from garage
Display parked cars
Find car
Check if garage is full

You might also like