Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

COS3711 Assigment 2 Year Module Due 2026

Beoordeling
-
Verkocht
-
Pagina's
30
Cijfer
A+
Geüpload op
23-03-2026
Geschreven in
2025/2026

Comprehensive Study Material; Expert Verified & Exam-Ready This assignment package has been carefully developed to support serious academic preparation. Each solution is thoroughly researched, clearly explained, and backed by credible references giving you not just the answers, but a genuine understanding of the underlying concepts. The material is structured for clarity, making even complex topics approachable without sacrificing depth or accuracy. Whether you're consolidating your knowledge or preparing under time pressure, these resources are designed to help you walk into any exam with confidence.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

UNIVERSITY OF SOUTH AFRICA
College of Science, Engineering and Technology


⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄⋄


COS3711: Advanced Programming

Assignment 2 — 2026

⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄⋄




COS3711
Module Code:
Advanced Programming
Module Name:
Assignment 2
Assignment:
2026
Year:




Submitted in partial fulfilment of the require-
ments for Advanced Programming — UNISA 2026

,UNISA | COS3711 Advanced Programming – Assignment 2



Question 1: Inheritance Hierarchy and Shape Drawing Application

Object-oriented design makes drawing applications considerably cleaner when shapes share
common properties. The Qt framework is well suited for this kind of work because its QPainter
API maps naturally onto pen-and-brush abstractions, and its widget system handles the ren-
dering surface (Stroustrup, 2013). The class hierarchy specified in the assignment separates
shared state from shape-specific measurements, which is exactly what abstract base classes
are for.


1.1 Design Overview


The hierarchy has three abstract layers and four concrete leaf classes. Shape holds pen width,
pen colour, and fill colour. Shape1Property extends Shape with one integer property (used
as radius for circles or side-length for squares). Shape2Property extends Shape1Property
with a second integer property (used for the second dimension of rectangles and ellipses).
The four concrete classes, Circle, Square, Ellipse, and Rectangle, each implement the pure
virtual draw() function. The UML diagram below captures this structure.

Shape
penWidth, penColour, fillColour
draw()




Shape1Property
property1
draw()




Shape2Property
property2
draw()




Circle Square
draw() draw()




Ellipse Rectangle
draw() draw()



Figure 1: UML inheritance hierarchy for the Shapes application



Page 2 of 30

, UNISA | COS3711 Advanced Programming – Assignment 2



1.2 Header Files


shape.h

1 # ifndef SHAPE_H
2 # define SHAPE_H
3


4 # include < QColor >
5 # include < QPainter >
6


7 class Shape {
8 public :
9 Shape () ;
10 Shape ( int penWidth , QColor penColour , QColor fillColour ) ;
11 virtual ~ Shape () {}
12


13 // Getters
14 int getPenWidth () const ;
15 QColor getPenColour () const ;
16 QColor getFillColour () const ;
17

18 // Setters
19 void setPenWidth ( int pw ) ;
20 void setPenColour ( QColor pc ) ;
21 void setFillColour ( QColor fc ) ;
22


23 virtual void draw ( QPainter & painter ) = 0;
24


25 protected :
26 int m_penWidth ;
27 QColor m_penColour ;
28 QColor m_fillColour ;
29 };
30


31 # endif // SHAPE_H




Page 3 of 30

Gekoppeld boek

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
23 maart 2026
Aantal pagina's
30
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

€4,34
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF


Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
BeeNotes teachmetutor
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
313
Lid sinds
11 maanden
Aantal volgers
0
Documenten
861
Laatst verkocht
1 week geleden
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 beoordelingen

5
23
4
4
3
8
2
1
1
3

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen