



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
ASSIGNMENT TWO - Advanced Programming (P) - Vo Minh Quoc ASSIGNMENT TWO - Advanced Programming (P) - Vo Minh Quoc ASSIGNMENT TWO - Advanced Programming (P) - Vo Minh Quoc ASSIGNMENT TWO - Advanced Programming (P) - Vo Minh Quoc ASSIGNMENT TWO - Advanced Programming (P) - Vo Minh Quoc
Typology: Essays (university)
1 / 27
This page cannot be seen from the preview
Don't miss anything!




















Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 20 : Advanced Programming Submission date 29 /06/2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Võ Minh Quốc Student ID GCD Class GCD0904 Assessor name Pham Thanh Son Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Quoc Grading grid P 3 P 4 M 3 M 4 D 3 D 4
Grade: Assessor Signature: Date: Internal Verifier’s Comments: Signature & Date:
Everything related to OOP, including OOP ideas, OOP traits, and much more, was already covered in the last report. Additionally, a basic introduction to UML and the relationship between classes was provided. In order to put all of the knowledge from the previous report into practice, I will pick a specific scenario to apply a program to in this report. The UML class diagram will also be included in the report for easy comprehension. Finally, a brief section on the design pattern that will be used in future projects.
I recently signed a contract with the FPT firm, and soon I'll be chosen to oversee a team of programmers as they create the company's shop management system. I have to build an application to keep a list of books in this shop management system. The system allows the user to input data on books and household appliances, including id, title, price, quantity, and... The system includes functions that customers need, such as adding, deleting, updating, and searching for book information.
This is a class diagram including four classes: IInformation (interface), Shop (contains CRUD function), Book (Parent class), GoldenEditionBook (Children class).
As mentioned above, this class is the child class of Book class or we can say it is applied the inheritance which is one of the characteristics of OOP, it inherits everything in parent class (Book class), and also I mentioned that the Book class contains the property ‘Price’ with the ‘virtual’ key word for child class having ability to change the logic inside of it (this is a Polymophism characteristic of OOP). C. Shop class: Class diagram: As mentioned above, Shop class plays an essential role in the whole program, because it includes a list of book and CRUD function. Here is the specification of explanation
In this part, I am going to show code of my program corresponding to the above class diagrams. A. Book class:
Below here is the code of IInformation interface:
A. Initial interface: When I run the program, it will return this interface. Although it is not user-friendly but, it contains enough options that user need. B. Add function: When I chose option 1 meaning add, the program will return to another options for user, they can choose ‘a’ for adding normal book, ‘b’ for adding golden edition book, ‘v’ for exiting. Then I chose ‘a’ and the program returned the interface for entering information, if entering information is successful, the program will return to adding menu option again.
If user enters the id, title, author which are not valid, the program will catch that and return the alert. After adding successfully, that book will appear in the list
D. Update: When I choose the option 6 and then enter information of the book which I need, the program will check if that book’s id is in the list or not, and then it will change the information of that book with that id corresponding to the id in the list, and print the alert. Before updating: After updating:
E. Delete: When I choose the option 5, and then enter the id of book which I want to delete, the program will find that book in list corresponding to the id entered, and delete it. Before deleting: After deleting:
Class diagram: On that class diagram, the class ‘Employee’ has only one instance which is Employee(), and function ‘GetInstance’ offers global access to ‘Employee()’ instance. B. Factory pattern:
The Factory Method Design Pattern offers an interface for producing an object but leaves it up to the classes that implement the interface to determine which class to instantiate. The Factory Pattern allows a class to defer instantiation to sub-classes. The factory pattern is used to replace class constructors by abstracting the object creation process so that the type of object created may be specified at run-time. (Alle, 2021) Class diagram: