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

Spring 2023 - CS304 - 2

The document provides instructions for Assignment #02 in the CS304 Object Oriented Programming course. It details rules for marking, including requirements that the submission be on time, openable, and not plagiarized. It also notes topics covered and uploading instructions. The assignment asks students to implement vehicle classes to handle the diamond problem inheritance scenario of a Truck class derived from both PassengerVehicle and GoodsVehicle classes, and include the specified attributes and methods. Main is to create a Truck pointer and call each method.

Uploaded by

namra misbah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Spring 2023 - CS304 - 2

The document provides instructions for Assignment #02 in the CS304 Object Oriented Programming course. It details rules for marking, including requirements that the submission be on time, openable, and not plagiarized. It also notes topics covered and uploading instructions. The assignment asks students to implement vehicle classes to handle the diamond problem inheritance scenario of a Truck class derived from both PassengerVehicle and GoodsVehicle classes, and include the specified attributes and methods. Main is to create a Truck pointer and call each method.

Uploaded by

namra misbah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Object Oriented Programming (CS304) Total marks = 20

Spring 2023
Assignment # 02 Due Date : July 13,
2023

Please carefully read the following instructions before attempting the assignment.

RULES FOR MARKING


It should be clear that your assignment would not get any credit if:
▪ The assignment is submitted after the due date.
▪ The submitted assignment does not open or the file is corrupt.
▪ Strict action will be taken if the submitted solution is copied from any other student or the
internet.

You should consult the recommended books to clarify your concepts as handouts are not sufficient.

Topic Covered:

● Lecture 21-36

Uploading instructions:

● Your assignment should be in .CPP format (Any other formats like scan images, PDF, zip, doc, rar
and bmp etc. will not be accepted).
● Save your assignment with your ID (e.g. bc000000000.CPP).
● No assignment will be accepted through email.
NOTE:

No assignment will be accepted after the due date via email in any case (whether it is the case of load
shedding or internet malfunctioning etc.). Hence refrain from uploading assignments in the last hour of the
deadline. It is recommended to upload the solution file at least two days before its closing date.

If you find any mistake or confusion in the assignment (Question statement), please consult with your
instructor before the deadline. After the deadline, no queries will be entertained in this regard.

For any query, feel free to email at: [email protected]

Question Statement Marks (20)

Consider you are working as a software developer in a company that manufactures vehicles. The company produces different types of vehicles,
including cars, motorcycles, and trucks. Each vehicle has a unique identification number and a maximum speed. Some vehicles have the capability
to transport passengers, while others can transport goods. Additionally, some vehicles have a towing capacity.
Your task is to implement the classes and handle the Diamond Problem, ensuring that the correct properties and behaviors are accessible to each
class.

Class Name Vehicle (Base class):

Attributes vehicleID (integer)


stores the unique identification number of the vehicle – use last four
digits of your Student ID
maxSpeed (float)
stores the maximum speed of the vehicle in km/h.
Methods displayVehicleDetails(): displays the vehicle's ID and maximum speed as
shown in the screenshot.

Class Name PassengerVehicle (Derived from Vehicle)


Methods transportPassengers()
displays a message indicating that the vehicle is transporting passengers
as shown in the screenshot.

Class Name GoodsVehicle (Derived from Vehicle)

Methods transportGoods() will displays a message indicating that the vehicle is


transporting goods as shown in the screenshot.

Class Name Truck (Derived from both PassengerVehicle and GoodsVehicle)

Methods tow()
displays a message indicating that the truck is towing as shown in the
screenshot.

Write main() to create pointer to Truck class and call the following functions using Truck class pointer:
 displayVehicleDetails()
 transportPassengers()
 transportGoods()
 tow()

Sample Output:
Best of Luck

You might also like