Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Exam (elaborations)

COS3711 Assignment 1 Semester 1 2026 (Answer Guide)

Rating
-
Sold
-
Pages
25
Grade
A+
Uploaded on
22-02-2026
Written in
2025/2026

COS3711 Assignment 1 Semester 1 2026 (Answer Guide) VERIFIED AND CERTIFIED ANSWERS. WRITTEN IN REQUIRED FORMAT AND WITHIN GIVEN GUIDELINES. IT IS GOOD TO USE AS A GUIDE AND FOR REFERENCE, NEVER PLAGARIZE. Thank you and success in your academics. UNISA, 2026

Show more Read less

Content preview

1|Page


COS3711 Assignment 1 Semester 1 2026 (Answer Guide)
VERIFIED AND CERTIFIED ANSWERS. WRITTEN IN REQUIRED FORMAT AND WITHIN
GIVEN GUIDELINES. IT IS GOOD TO USE AS A GUIDE AND FOR REFERENCE, NEVER
PLAGARIZE. Thank you and success in your academics.
UNISA, 2026




QUESTION 1

Object-Oriented Design: Vehicle Management Console Application (Qt)

1.1 Introduction and Design Approach

The objective of this question is to design and implement a Qt-based console
application that manages vehicle details while adhering strictly to object-oriented
programming (OOP) principles. The design avoids common anti-patterns such as
code duplication, tight coupling, and poor encapsulation.

To achieve this:

 Inheritance is used to model shared vehicle characteristics.
 Polymorphism is applied to allow different vehicle types to output their details
appropriately.
 Encapsulation ensures that class attributes are protected and accessed through
getters and setters.
 Qt’s parent–child (QObject) mechanism is used to manage a list of vehicles
safely and efficiently without manual memory management.

1.2 Identification of Required Classes

Based on the specification, the following classes are required:

1. Vehicle – Base class representing common vehicle attributes
2. PassengerVehicle – Derived class for vehicles that carry passengers

,2|Page


3. TransportVehicle – Derived class for vehicles that carry goods
4. Main application (main.cpp) – Used to test the implementation

1.3 Base Class: Vehicle

1.3.1 Purpose of the Class

The Vehicle class represents the general concept of a vehicle. It contains properties
that are common to all vehicles, namely:

 Model
 Year of manufacture

This class is designed as a QObject-derived class to enable the use of Qt’s parent–
child system.

1.3.2 Attributes

 QString model – Stores the vehicle model
 int year – Stores the year of manufacture

The year value is validated to ensure it is reasonable, meaning:

 It is not earlier than the invention of modern vehicles
 It is not later than the current year

1.3.3 Constructors

 A default constructor assigns safe default values when no information is
provided.
 This satisfies the requirement that vehicles created without necessary details
must still have valid values.

1.3.4 Getters, Setters, and Output Function

, 3|Page


class Vehicle : public QObject {
Q_OBJECT


public:
explicit Vehicle(QObject *parent = nullptr)
: QObject(parent), m_model("Unknown"), m_year(2000) {}


QString getModel() const {
return m_model;
}


void setModel(const QString &model) {
m_model = model;
}


int getYear() const {
return m_year;
}


void setYear(int year) {
if (year >= 1886 && year <= QDate::currentDate().year()) {
m_year = year;
}
}


virtual void printDetails() const {
qDebug() << "Model:" << m_model << ", Year:" << m_year;
}


private:
QString m_model;

Document information

Uploaded on
February 22, 2026
Number of pages
25
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

R50,00
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ZaProff University of South Africa (Unisa)
View profile
Follow You need to be logged in order to follow users or courses
Sold
2215
Member since
3 year
Number of followers
531
Documents
2357
Last sold
1 day ago

3,8

365 reviews

5
158
4
70
3
75
2
25
1
37

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions