100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

COS3711 Assignment 1 (COMPLETE GUIDELINE) 2025

Beoordeling
3.5
(4)
Verkocht
16
Pagina's
15
Cijfer
A+
Geüpload op
14-04-2025
Geschreven in
2024/2025

COS3711 Assignment 1 (COMPLETE GUIDELINE) 2025 - DUE April 2025; 100% TRUSTED Complete, trusted solutions and explanations. For assistance, Whats-App 0.6.7-1.7.1-1.7.3.9. Ensure your success with us.... Question 1 Write a console application that can be run from the command line using the following forms: count // run without any parameters count // pass one file name count fileT // pass more than one file name count –a –b fileT // pass flags to change behaviour count –ab –c // pass flags in an alternative way If no arguments are provided, then print a message describing what arguments should be included. The application should, using regular expressions, count the number of occurrences of each of the following in the text files given. • If the –a flag is set, count the number of words longer than 4 characters that start with a capital letter. There may be further capital letters in the word. • If the –b flag is set, count the number of words that are hyphenated. This hyphen should not be at the start or end of a word. • If the –c flag is set, count the number of words that start and end on the same character. • If the –d flag is set, count the number of words that do not start with a vowel. Note that these words can start with any character, and do not just have to start with alphabetic characters. If no flags are provided, it is assumed that all counts should be performed. It is suggested that you remove all whitespace at the start and end of the document, as well are removing all punctuation (.,?!:; and so on) – try doing this using a regular expression. Assume that there is only 1 space between words. Remember that to set command line arguments in Qt Creator, click on Projects in the left menu, click on the Run menu and enter the arguments in the Command line arguments field. You can also click the Run in terminal check box. Downloaded by Polar magnats () lOMoARcPSD| COS3711/Assignment 1/2025 3 See the screenshot below for an example of the output for the arguments that were used above. Question 2 Create a graphical user interface that allows a user to deposit or withdraw an amount. Display the current date on the interface. Below is an example of such an interface. Create a Transaction class that stores the date, time, amount, and type of transaction (deposit or withdrawal, implemented as an enum). Transactions should be handled as pointers. Downloaded by Polar magnats () lOMoARcPSD| COS3711/Assignment 1/2025 4 Create a TransactionList class that keeps a single list of transactions. There should be only one instance of this list allowed, so implement it using the Singleton design pattern. When the user clicks the Deposit or Withdrawal button, the transaction should be written to the transaction list. Display the transaction in a console window as well (this is as a check that the transaction is actually being created. When the user clicks on the To file button, the list of transactions should be written to a human-readable text file. Ensure that your graphical user interface class handles only the interface, and does not contain code that is used to manage the transaction list; create a separate class for this purpose. Question 3 In this exercise, you will design a simple calculator with four basic operations, namely addition, subtraction, multiplication, and division. Implementation of this simple calculator should separate the code for user interface and mathematical operations. The code for performing mathematical operations should be designed using the following class hierarchy: Downloaded by Polar magnats () lOMoARcPSD| COS3711/Assignment 1/2025 5 The Operation class hierarchy contains the logic for performing various mathematical operations. A concrete class in this hierarchy represents one mathematical operation, which is performed in its compute() function that returns the result of an operation. Implement the Factory method design pattern using one factory class named OperationFactory so that an instance of a class in the Operation class hierarchy can be created based on the requested operation (+, -, *, /). Additionally, OperationFactory should also be an implementation of Singleton. The user interface for the calculator should make use of five QPushbuttons, two QDoubleSpinBoxes and one QLCDNumber as shown below: QDoubleSpinBoxes allow user to enter numbers and QLCDNumber is for displaying the result of the calculation. To use the calculator, the user should first enter two numbers and then select one of the four (+, -, *, /) buttons. The result of the operation is displayed in QLCDNumber. The button clear is used to clear QDoubleSpinBoxes and QLCDNumber. Note the following: • The signals emitted by the four buttons (+, -, *, /) should be handled in a single slot. • The user interface code should make use of the Operation class hierarchy to get the result of the requested operation. • Handle overflow in QLCDNumber display appropriately. • Handle division by 0 appropriately.

Meer zien Lees minder
Instelling
Vak








Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Gekoppeld boek

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
14 april 2025
Aantal pagina's
15
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

COS3711
Assignment 1 2025
Detailed Solutions, References & Explanations

Unique number:

Due Date: April 2025
QUESTION 1

Console Application

#include <QCoreApplication>
#include <QFile>
#include <QTextStream>
#include <QRegularExpression>
#include <QDate>
#include <QStringList>
#include <iostream>

void printUsage() {
std::cout << "Usage:\n";
std::cout << "count [flags] [file1.txt file2.txt ...]\n";
std::cout << "Flags:\n";
std::cout << " -a Count capitalized words longer than 4
characters\n";
std::cout << " -b Count hyphenated words\n";
std::cout << " -c Count words that start and end with the same
letter\n";
std::cout << " -d Count words that do NOT start with a vowel\n";
} Terms of use
By making use of this document you agree to:
QString preprocessText(const QString &content) {
 Use this document as a guide for learning, comparison and reference purpose,
Terms of use
 Not to duplicate, reproduce and/or misrepresent the contents of this document as your own work,
By making use of this document you agree to:
 Use this document
Fully accept the consequences
solely as a guide forshould you plagiarise
learning, reference,or and
misuse this document.
comparison purposes,
 Ensure originality of your own work, and fully accept the consequences should you plagiarise or misuse this document.
 Comply with all relevant standards, guidelines, regulations, and legislation governing academic and written work.

Disclaimer
Great care has been taken in the preparation of this document; however, the contents are provided "as is" without any express or
implied representations or warranties. The author accepts no responsibility or liability for any actions taken based on the
information contained within this document. This document is intended solely for comparison, research, and reference purposes.
Reproduction, resale, or transmission of any part of this document, in any form or by any means, is strictly prohibited.
$3.04
Krijg toegang tot het volledige document:
Gekocht door 16 studenten

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten

Beoordelingen van geverifieerde kopers

Alle 4 reviews worden weergegeven
6 maanden geleden

5 maanden geleden

good , was very helpfull in understadning the assingment

7 maanden geleden

7 maanden geleden

3.5

4 beoordelingen

5
1
4
2
3
0
2
0
1
1
Betrouwbare reviews op Stuvia

Alle beoordelingen zijn geschreven door echte Stuvia-gebruikers na geverifieerde aankopen.

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.
EduPal University of South Africa (Unisa)
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
149159
Lid sinds
7 jaar
Aantal volgers
35995
Documenten
4310
Laatst verkocht
5 uur geleden

4.2

13554 beoordelingen

5
7802
4
2688
3
1790
2
455
1
819

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

Veelgestelde vragen