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 Due Year 2026

Rating
-
Sold
-
Pages
23
Grade
A+
Uploaded on
16-02-2026
Written in
2025/2026

COMPREHENSIVE ANSWERS. DISTINCTION GUARANTEED This 100% exam-ready assignment come with expert-verified answers, in-depth explanations, and reliable references, meticulously crafted to ensure you grasp every concept with ease. Designed for clarity and precision, these fully solved material is your key to mastering any subject and acing your exams.

Show more Read less
Institution
Course

Content preview

COS3711
Assignment 1
Due 2026

,Question 1


Vehicle hierarchy and Qt parent–child list


1.1 Interpretation of the requirements


The task is to design a console-based vehicle management application using
sound object oriented principles and Qt features. The specification requires
the following:


* Each vehicle must have:
* a model (text)
* a year (integer with a reasonable range)
* There are two specialised vehicle types:


* Passenger vehicles with a passenger count
* Transport vehicles with a carrying capacity in kilograms
* Vehicles created without explicit values must use sensible defaults
* All appropriate getters and setters must be provided
* A function must output vehicle details
* A list of vehicles must be implemented using Qt’s parent–child facility
* The program must create several vehicles (including one using the default
constructor), add them to the list, and print them to the console


To support reflection later in Question 2, it is appropriate to design all
classes as subclasses of QObject and expose their data through Q_PROPERTY.

,1.2 Class design overview


A clean design is a small inheritance hierarchy:


* Vehicle (base class)
* PassengerVehicle (derived class)
* TransportVehicle (derived class)


This avoids redundant code and follows OOP principles such as reuse and
polymorphism.


Vehicle (Base Class)


Superclass: QObject
Attributes:


* QString model
* int year


Operations:


* Constructors with default values
* Getter and setter for model
* Getter and setter for year (with validation)
* Virtual function describe() to output details

,PassengerVehicle (Derived from Vehicle)


Additional attribute:


* int passengerCount


Operations:


* Getter and setter for passenger count
* Override describe()


TransportVehicle (Derived from Vehicle)


Additional attribute:


* double capacityKg


Operations:


* Getter and setter for capacity
* Override describe()


All classes inherit QObject, include Q_OBJECT, and define Q_PROPERTY entries
so their properties can be inspected reflectively.

, 1.3 Base Vehicle class design


The Vehicle class stores common data and ensures values remain valid.


```cpp
class Vehicle : public QObject {
Q_OBJECT
Q_PROPERTY(QString model READ model WRITE setModel)
Q_PROPERTY(int year READ year WRITE setYear)


public:
explicit Vehicle(const QString &model = "Unknown",
int year = QDate::currentDate().year(),
QObject *parent = nullptr)
: QObject(parent), m_model(model), m_year(year)
{
setYear(m_year); // ensure validation
}


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


int year() const { return m_year; }
void setYear(int year) {
int current = QDate::currentDate().year();
if (year < 1886 || year > current + 1)
m_year = current;
else
m_year = year;
}


virtual QString describe() const {
return QString("Model: %1, Year: %2").arg(m_model).arg(m_year);

Connected book

Written for

Institution
Course

Document information

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

Subjects

$4.91
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


Also available in package deal

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.
BeeNotes teachmetutor
Follow You need to be logged in order to follow users or courses
Sold
313
Member since
11 months
Number of followers
0
Documents
861
Last sold
1 week ago
BeeNotes

BeeNotes: Buzzing Brilliance for Your Studies Discover BeeNotes, where hard-working lecture notes fuel your academic success. Our clear, concise study materials simplify complex topics and help you ace exams. Join the hive and unlock your potential with BeeNotes today!

4.1

39 reviews

5
23
4
4
3
8
2
1
1
3

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card 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