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
Overig

COS3711 Assignment 3 memo 2024 ready to submit

Beoordeling
4,7
(3)
Verkocht
23
Pagina's
25
Geüpload op
04-09-2024
Geschreven in
2024/2025

COS3711 Assignment 3 memo 2024 Assignment 3 1. Introduction Please use CMake (and not qmake) when setting up your assignment projects. Qt Designer should not be used to design user interfaces, and you are expected to manually set up GUIs to ensure that you properly handle memory using Qt’s parent-child functionality. Good programming practices should be followed. Follow standard naming conventions: class names start with a capital letter, variable and function names start with a lowercase letter, using camelCase for names made up of multiple words. Ensure consistent code layout and use of blank lines. Use forward class declarations in header files. Use initialiser lists in constructors. Have proper GUI management: setting cursor focus, sequential tabbing, clearing input widgets (like text input fields being cleared and spin boxes being returned to some default value), and enabling and disabling buttons as appropriate. Provide appropriate user feedback. Your code should build and run without any warnings.2. Questions Question 1 Refer to the UML diagram to answer this question. The Book class is burdened with two additional responsibilities: 1. obtainbookInfo() to get user input on book details (title, authors, ISBN, and date of publication) via a console, and 2. saveBook() to save the state of a Book instance into a file. Redesign the Book class so that the concept/process currently included in it is achieved using three different classes: 1. The Book class to represent a book with the necessary functions (as given in the above UML diagram). Remember that a book may have more than one author. 2. A BookWriter class which saves the state of a Book instance (values of the data members of that instance) in a file (you may save it in any sensible format). 3. A Graphical User Interface (GUI) class BookInput, which allows users to enter book information to create Book instances, which should also be saved to afile (using the BookWriter). Note: You can decide when Book instance(s) should be saved. Question 2 Make necessary changes to the Book class so that you can access the data members of Book instances using QMetaObject. Rewrite the BookWriter class so that the state of a Book instance can be accessed using the generated QMetaObject. Test the modified Book and BookWriter using BookInput. Question 3 Different systems use different rules for choosing passwords. Here are some examples of such rules: Rule 1: It must consist of a minimum of five characters and no spaces are allowed. Rule 2: It must consist of 5 characters, where the third character can be either a digit or an alphabetic character (a-f or A-F). Rule 3: It must consist of a minimum of four and a maximum of six digits and the starting digit cannot be 0. Write a program that asks the user to select one validation technique stated above using QCheckBox and then to enter a password in a QLineEdit. The program should evaluate whether the provided password satisfies the selected validation rule. Question 4 Write a class named PrimeFinder, capable of running as a thread, to find prime numbers between two given numbers. Write a GUI application that allows a user to enter start and end numbers as well as the number of threads to use (maximum 4). When Start is clicked, the task should be divided into the required number of parts, the required number of PrimeFinder threads started, and the primes displayed in an appropriate window (per thread) as they are found. This is to be done without using QtConcurrent – you are to manage the threads yourself, and clean up after the threads have completed their work. This means that youshould be able to change the start, end, and number of thread numbers and click Start again without the program crashing or producing strange results. Also, you should handle a user closing the application (closeEvent) before the threads have completed running so that the threads can tidy up after themselves before the application is closed. The above screenshot is only an example, and you can design the graphical user interface as you wish as long as it satisfies the above requirements.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

COS3711 2024 ASSIGNMENT 3
MEMO
THERE IS A LINK TO THE ZIPPED FILE AT THE END OF THIS DOCUMENT



Crystal Indigo!
Crystal Indigo!
Providing all solutions you need anytime
+27 76 626 8187




**NOTE: if the GUI is displaying differently from what you desire just change
how the widgets are displayed. copy the code and run DO necessary
changes. If you having trouble running, reach out

,Redesigned UML
Code Outputs
Q1 and 2 the GUI output is the same, just different code

,Q3

,
,Q4




Source Code

Question 1

//book.h
#ifndef BOOK_H
#define BOOK_H
#include <QString>
#include <QStringList>
#include <QDate>

class Book {
public:
Book();
Book(const QString& t, const QStringList& a, const QString& i, const
QDate& p);

, void setTitle(const QString& t);
void setAuthors(const QStringList& a);
void setIsbn(const QString& i);
void setPublicationDate(const QDate& p);

QString getTitle() const;
QStringList getAuthors() const;
QString getIsbn() const;
QDate getPublicationDate() const;

private:
QString title;
QStringList authors;
QString isbn;
QDate publicationDate;
};

#endif // BOOK_H


//book.cpp
#include "book.h"

Book::Book() {}

Book::Book(const QString &t, const QStringList &a, const QString &i, const
QDate &p)
: title(t), authors(a), isbn(i), publicationDate(p) {}

void Book::setTitle(const QString &t)
{
title = t;
}
void Book::setAuthors(const QStringList &a)
{
authors = a;
}
void Book::setIsbn(const QString &i)
{
isbn = i;
}
void Book::setPublicationDate(const QDate &p)
{
publicationDate = p;
}

QString Book::getTitle() const
{
return title;
}

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
4 september 2024
Aantal pagina's
25
Geschreven in
2024/2025
Type
OVERIG
Persoon
Onbekend

Onderwerpen

€9,13
Krijg toegang tot het volledige document:
Gekocht door 23 studenten

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

Beoordelingen van geverifieerde kopers

Alle 3 reviews worden weergegeven
1 jaar geleden

projects are always perfect. 100% guaranteed

1 jaar geleden

Thank you luwayla

1 jaar geleden

1 jaar geleden

4,7

3 beoordelingen

5
2
4
1
3
0
2
0
1
0
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.
CrystalIndigo University of South Africa (Unisa)
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
486
Lid sinds
5 jaar
Aantal volgers
226
Documenten
73
Laatst verkocht
5 maanden geleden
CrystalIndigo Solutions

providing all solutions to all computer science modules

4,1

51 beoordelingen

5
27
4
13
3
6
2
1
1
4

Populaire documenten

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