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
Document preview thumbnail
Preview 2 out of 10 pages
Exam (elaborations)

COS3711 Assignment 1 (COMPLETE ANSWERS) 2026 - Due 15 May 2026

Document preview thumbnail
Preview 2 out of 10 pages

Advanced Programming - COS3711 Assignment 1 2026 - Due 15 May 2026; 100 % TRUSTED workings, Expert Solved, Explanations and Solutions. For assistance call or W.h.a.t.s.a.p.p us on ...(.+.2.5.4.7.7.9.5.4.0.1.3.2)........... COS3711/Assignment 1/2026 For this question you need to ensure that you design the appropriate classes needed to address the specification below. Create a console application to handle vehicle details. Considering the required functionality that is required and OOP design principles (avoiding anti-patterns and having minimal redundant code), create and implement the appropriate classes necessary to achieve the following. • A vehicle needs to have a model and a year (which should be a reasonable value). There are basically 2 types of vehicles: passenger vehicles (that can carry a specified number of passengers) and transport vehicles (that have a set carrying capacity expressed in kilograms). Vehicles that are created without the necessary details should have default values. • Ensure all appropriate getters and setters are included. • Include a function that can output the details of the vehicle. • Use Qt’s parent-child facility to implement a list of vehicles. • Test your solution by creating some passenger and transport vehicles (at least one of which is created using the default constructor), adding them to the list, and then outputting the values in the list to the console. Question 2 This question tests the concepts of reflection and meta-objects. Extend the application you wrote in question 1 by adding a class named FileWriter as described in the UML class diagram below:

Content preview

COS3711
ASSIGNMENT 1 2026

UNIQUE NO.
DUE DATE: 15 MAY 2026

, Advanced Programming - COS3711

Question 1: Vehicle Console Application (OOP + Qt Parent-Child)

Vehicle Base Class (vehicle.h)

#ifndef VEHICLE_H
#define VEHICLE_H

#include <QObject>
#include <QString>

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

public:
explicit Vehicle(QObject *parent = nullptr);
Vehicle(QString model, int year, QObject *parent = nullptr);

QString getModel() const;
int getYear() const;

void setModel(const QString &model);
void setYear(int year);

virtual QString toString() const;

protected:
QString model;
int year;
};

#endif

Vehicle Implementation (vehicle.cpp)

#include "vehicle.h"

Vehicle::Vehicle(QObject *parent) : QObject(parent), model("Unknown"),
year(2000) {}

Vehicle::Vehicle(QString model, int year, QObject *parent)
: QObject(parent), model(model), year(year > 1885 ? year : 2000) {}

QString Vehicle::getModel() const { return model; }
int Vehicle::getYear() const { return year; }

void Vehicle::setModel(const QString &model) { this->model = model; }

Connected book
 image
Gianna Cioni, Andrzej Salwicki Advanced Programming Methodologies
Publisher: 2014 ISBN: 9781483265452 Edition: Unknown

Document information

Uploaded on
April 27, 2026
Number of pages
10
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$3.01

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

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.
LIBRARYpro
3.8
(1504)
Sold
10767
Followers
4904
Items
5056
Last sold
5 days ago



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