Assignment 1 2023
(Complete Program Files Included)
Due Date: 26 May 2023
Solutions, Explanations, workings, and references
+27 81 278 3372
COS2614 Assignment 1 2023 Answers, guidelines, workings and references. ............................................. Question 1 Write a Qt Graphical User Interface (GUI) program to generate a username and an initial password given the full name of the user. Given below are the rules for generating a valid username: • It consists of 5 characters, where the first character is in upper case and the rest of the four characters are in smaller case. • The user name is created by combining the first 4 characters of the surname with the first character of the first name. • If the surname does not have 4 characters, more characters are taken from the first name to make up the user name. • If the surname and the first name combined is less than 5 characters then append sufficient number of 0s to create the username. An initial password is generated by combining randomly selected 5 characters from the full name of the user. Note than no spaces are allowed in the username or password. User input should be obtained using a QInputDialog. You can expect the full name as a single string where each word is separated using a space. For example: Mike William Owen. The output (username and password) should be displayed using a QMessageBox. You need not do any verification of the user input. Question 2 Implement the following classes in the UML class diagram according to the description that follows: A product is described using a name, a price and a supplier. The supplier and the manufacturer can be the same for a product. A Product is initialised using a name and a price. The supplier details are set using the function setSupplier(), which invokes the suitable function of Vendor to set the details of the vendor. If one requests a product for its manufacturer, it returns the name of the vendor stored in m_Supplier, if it is set as the manufacturer. Otherwise an Unknown string is returned. toString() of Vendor returns a string representation of the values of its data members in a readable format. toString() of Product always returns a string representation of a product. If supplierDetails in toString() of Product is true, it returns both the supplier and product details. Otherwise only product details are returned. Implement it as a console application, where the product and supplier details are entered from the keyboard. Display the results of getManufacturerName() and toString()(for both true and false parameter values) on the console.
All reviews are made by real Stuvia users after verified purchases.
Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.
No worries! You can instantly pick a different document that better fits what you're looking for.
No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.
“Bought, downloaded, and aced it. It really can be that simple.”