100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

COS3711 Assignment 3 memo 2024 ready to submit

Rating
4,7
(3)
Sold
23
Pages
25
Uploaded on
04-09-2024
Written 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.

Show more Read less













Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
September 4, 2024
Number of pages
25
Written in
2024/2025
Type
Other
Person
Unknown

Subjects

Content preview

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;
}
R173,33
Get access to the full document:
Purchased by 23 students

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Reviews from verified buyers

Showing all 3 reviews
1 year ago

projects are always perfect. 100% guaranteed

1 year ago

Thank you luwayla

1 year ago

1 year ago

4,7

3 reviews

5
2
4
1
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

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.
CrystalIndigo University of South Africa (Unisa)
View profile
Follow You need to be logged in order to follow users or courses
Sold
486
Member since
5 year
Number of followers
226
Documents
73
Last sold
2 months ago
CrystalIndigo Solutions

providing all solutions to all computer science modules

4,1

51 reviews

5
27
4
13
3
6
2
1
1
4

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions