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

COS2614 Assignment 1 Year 2023 Solutions + Output + Explaination

Rating
-
Sold
-
Pages
6
Uploaded on
08-06-2023
Written in
2022/2023

Complete Solutions to COS2614 Assignment 1 for the year 2023. Includes Code, Output of run-time, and Explaination.

Institution
Course








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

Written for

Institution
Course

Document information

Uploaded on
June 8, 2023
Number of pages
6
Written in
2022/2023
Type
Other
Person
Unknown

Subjects

Content preview

Question 1:

Output:




Explaination:
1. The program starts by importing the necessary modules from PyQt5 for creating the GUI.

2. The generate_username function takes the full name as input and splits it into separate first
name and surname components.

3. If the surname has four or more characters, the username is created by taking the first four
characters of the surname and appending the first character of the first name.

4. If the surname has fewer than four characters, the username is created by combining the entire
surname with as many characters as needed from the first name to reach a total length of five
characters.

5. If the resulting username is less than five characters, it appends the required number of zeros
to reach a length of five characters.

6. The generate_password function takes the full name as input, removes any spaces, and
randomly selects five characters from the remaining characters to create the password.

7. The main part of the code creates a Qt application and prompts the user to enter their full
name using a QInputDialog.

8. The entered full name is used to generate the username and password by calling the respective
functions.

9. The generated username and password are displayed in a QMessageBox as an information
message.

10. When the program is run, it displays a dialog for the user to enter their full name. After
entering the name and clicking OK, a message box appears showing the generated username
and password.

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.
Learn2Progress Learn2Progress
Follow You need to be logged in order to follow users or courses
Sold
75
Member since
3 year
Number of followers
63
Documents
15
Last sold
1 year ago

4.6

5 reviews

5
4
4
0
3
1
2
0
1
0

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

Frequently asked questions