
























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
Pass Assignment 1 Advanced Programming FPT
Typology: Assignments
Uploaded on 10/11/2022
5
(13)6 documents
1 / 32
This page cannot be seen from the preview
Don't miss anything!

























ASSIGNMENT 2 FRONT SHEET Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 20: Advanced Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Nguyį» n Hùng HuĆ¢n Student ID GBS Class GCS090 3 A Assessor name LĆ¢m Nguyį» n Trung Nam 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 Huan Grading grid P 3 P 4 M 3 M 4 D 3 D 4
ASSIGNMENT 2 BRIEF Qualification BTEC Level 5 HND Diploma in Computing Unit number Unit 20 : Advanced Programming Assignment title Application development with class diagram and design patterns Academic Year 2022 Unit Tutor LĆ¢m Nguyį» n Trung Nam Issue date Submission date Submission Format: Format: The submission is in the form of a group written report. This should be written in a concise, formal business style using single spacing and font size 12. You are required to make use of headings, paragraphs and subsections as appropriate, and all work must be supported with research and referenced using the Harvard referencing system. Please also provide a bibliography using the Harvard referencing system. Submission Students are compulsory to submit the assignment in due date and in a way requested by the Tutors. The form of submission will be a soft copy in PDF posted on corresponding course of http://cms.greenwich.edu.vn/ Note: The Assignment must be your own work, and not copied by or from another student or from books etc. If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you must reference your sources, using the Harvard style. Make sure that you know how to reference properly, and that understand the guidelines on plagiarism. If you do not, you definitely get fail Assignment Brief and Guidance: Scenario : (continued from Assignment 1) Your team has shown the efficient of UML diagrams in OOAD and introduction of some Design Patterns in usages. The next tasks are giving a demonstration of using OOAD and DP in a small problem, as well as advanced discussion of range of design patterns. Tasks: Your team is now separated and perform similar tasks in parallel. You will choose one of the real scenarios that your team introduced about DP in previous phase, then implement that scenario based on the corresponding class diagram your team created. You may need to amend the diagram if it is needed for your implementation. In additional, you should discuss a range of DPs related / similar to your DP, evaluate them against your scenario and justify your choice. In the end, you need to write a report with the following content: ļ· A final version of the class diagram based on chosen scenario which has potential of using DP.
ļ· Result of a small program implemented based on the class diagram, explain how you translate from design diagram to code. ļ· Discussion of a range of DPs related / similar to your DP, evaluate them against your scenario and justify your choice (why your DP is the most appropriate in that case). Learning Outcomes and Assessment Criteria Pass Merit Distinction LO 3 Implement code applying design patterns P3 Build an application derived from UML class diagrams. M3 Develop code that implements a design pattern for a given purpose. D3 Evaluate the use of design patterns for the given purpose specified in M3. LO4 Investigate scenarios with respect to design patterns P4 Discuss a range of design patterns with relevant examples of creational, structural and behavioral pattern types. M4 Reconcile the most appropriate design pattern from a range with a series of given scenarios. D4 Critically evaluate a range of design patterns against the range of given scenarios with justification of your choices.
ļ· As mentioned that the class Information is an interface, the function inside of it is PrintInformation() which is used for other class inheriting and then adding logic to printing information to screen. ļ· Class Shop contains a list of book and CRUD functions, more specifically, those functions are Addbook() (Create), PrintInformation() (Read), FindBookById() (Read), FindBookByName() (Read), CheckId() (for check Id which is valid or not for when user enter), UpdateBookById() (Update), RemoveBookById() (Delete) ļ· Class Book contains fields (id, title, author, price, and quantity), constructor, properties (Id, Title, Author, Price, and Quantity) for encapsulating field, and method PrintInformation() to print information.
GoldenEditionBook: Class diagram: 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). 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 functions. Here is the specification of the explanation ļ· books: is the list to contain books inside ļ· AddBook(): used for adding more books to the list ļ· PrintInformation(): is the function inheriting from the Information interface, which changed the logic inside of it into the function for printing all of the information of all books. ļ· FindBookById(): Each book has its unique id so I created this function in order to find the book
ļ· in the most convenient way for the user. ļ· FindBookByName(): Each book has its own name, but its name can be the same, I create this function to find book by its name (means title) to keep track of how many books with the same name are entered. ļ· CheckId(): Because the id of each book is unique, I created this function for checking the id if it is duplicated or not, if duplicated, the user will be asked to enter the other id to avoid two duplicated id in the ābooksā list. ļ· UpdateBookById(): It is hard to update a book by its title, price, and quantity but the id of each book is unique, so I create this function to update the book by its id. ļ· RemoveBookById(): This is the last function to delete the book by its id. information interface: Class diagram: As I mentioned above, this class is used for containing declarations of method āPrintInformationā, and two classes āBookā and āShopā inheriting this class in order to get this function and then changing the adding the logic inside of this function to meet their classās functional requirement
Method: This is a method for printing information of book
GoldenEditionBook class: Constructor: This is a constructor of GoldenEditionBook based on its class parent (Book) Properties: This is a property overrode to change the logic inside it.
CheckId(): this is the function to check id by compare id in list with entered id. RemoveBookById(): This is the function to delete book by its id, the id will be found first then delete PrintInformation(): This is the function inherited from the āinformationā interface, and then I added the logic inside it. FindBookById(): This is the function to find the book by id, if the list has that book with the id corresponding with id entered, the function will return information about that book. FindBookByName(): This is the function to find the book by name, if the list has those books with the name corresponding with the name entered, the function will return information about those books.
UpdateBookById(): This is the function to update book by id, user can firstly change the information of book which they need, then the program will find that id and change the information, if list has no book with that id, the program will return the false and doesnāt change that information. Interface: Below here is the code of Information interface: It just includes the declaration of the method āPrintInformation()ā.
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
Read function: When I choose option 2, the program will print all information of all books. When I choose option 3, and enter id, the program will print information of book having that id. When I choose option 4, and enter name of book, the program will print all information of books having that name.