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 4 2026 Advanced Programming Year Module, 2026

Document preview thumbnail
Preview 2 out of 10 pages

This assignment has been carefully put together to give you more than just answers; it walks you through the reasoning behind each one, so you actually understand the material rather than just memorising it. Every solution has been verified for accuracy, with academic references that hold up to scrutiny. Whether you're working through it the night before a submission or using it to reinforce your understanding over time, it's built to be genuinely useful. The explanations are clear without being condescending, and the structure follows what examiners actually look for not just what sounds impressive. If you put in the effort to engage with it properly, distinction-level results are well within reach.

Content preview

UNIVERSITY OF SOUTH AFRICA (UNISA)
College of Science, Engineering and Technology — Computer Science Department







Assignment 4
Rainfall Tracking Application: Design Patterns, XML, Regular Expressions and Threading







Module Code: COS3711

Module Name: Advanced Programming

Assignment No.: Assignment 4

Tutorial Letter: 104/0/2026

Semester: Year Module, 2026




Submitted in partial fulfilment of the requirements for Advanced Programming
at the University of South Africa.

, UNISA | COS3711 Advanced Programming — Assignment 4



Question 1: UML Design of the Rainfall Tracking System

The rainfall scenario asks for a container of rain records, each holding a station code, a date and a
millimetre value, together with a mechanism for turning that container into an XML representation
that can be handed to a choice of graph. A client class owns the record and decides which graph
to draw, which points directly at the Strategy pattern: the graph type is an interchangeable algo-
rithm selected at runtime by the client, and the family of graphs shares a common interface so the
client does not need to know which concrete graph it is holding (Gamma et al., 1994:315).


1.1 Partial UML Class Diagram


The design below separates four responsibilities: the RainData class that holds a single reading,
the RainRecord container that aggregates all readings and can produce an XML string, the Graph
interface with its two concrete strategies BarGraph and ColumnGraph, and the Client class that
owns the record, requests the XML, and delegates drawing to whichever graph the user selects.

Client / GUI

− record : RainRecord
− graph : Graph*

+ setGraph(g : Graph*) : void
+ requestGraph() : void
+ addRainData(d : RainData) :
void uses

1

RainRecord
Graph
− readings : QVector<RainData>

+ addReading(d : RainData) : void + draw(xml : QString) : void
+ toXml() : QString
1 ...*
RainData

− station : QString
BarGraph ColumnGraph
− date : QDate
− mm : double
+ draw(xml : QString) : void + draw(xml : QString) : void
+ getStation() : QString
+ getDate() : QDate
+ getMm() : double


Figure 1: Partial UML class diagram for the rainfall tracking application

The diagram shows how data moves through the system. RainData objects are aggregated inside
RainRecord, which is itself held by the Client. The client calls toXml() on its record and passes
the resulting string to whichever concrete Graph the user has chosen through setGraph(), so no
graph class needs to know how the XML was built.




Page 1 of 9

Connected book
 image
Publisher: 1970 ISBN: 9780983384021 Edition: Unknown

Document information

Uploaded on
July 25, 2026
Number of pages
10
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$16.11

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.
LectureLab
3.6
(86)
Sold
683
Followers
188
Items
1553
Last sold
1 week 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