100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS2614 Assignment 1 Year 2023 Solutions + Output + Explaination R100,00
Add to cart

Other

COS2614 Assignment 1 Year 2023 Solutions + Output + Explaination

 21 views  0 purchase

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

Preview 1 out of 6  pages

  • June 8, 2023
  • 6
  • 2022/2023
  • Other
  • Unknown
All documents for this subject (47)
avatar-seller
Learn2Progress
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.

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Learn2Progress. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R100,00. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

52510 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R100,00
  • (0)
Add to cart
Added