Assignment 2 - Advanced Programming - PASS, Assignments of Computer Science

Assignment 2 - Advanced Programming - PASS

Typology: Assignments

2021/2022

Uploaded on 11/08/2022

minh-huy-huynh
minh-huy-huynh 🇻🇳

4.7

(58)

39 documents

1 / 57

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 2 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 20: Advanced Programming
Submission date
23/10/2022
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Huynh Minh Huy
Student ID
GCD210173
Class
GCD1001
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
Huy
Grading grid
P3
P4
M3
M4
D3
D4
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39

Partial preview of the text

Download Assignment 2 - Advanced Programming - PASS and more Assignments Computer Science in PDF only on Docsity!

ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 20: Advanced Programming Submission date 23/10/2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Huynh Minh Huy Student ID GCD Class GCD1001^ 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 Huy

Grading grid P3 P4 M3 M4 D3 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

CHAPTER 1 – INTRODUCTION.

The previous report covered everything OOP-related, including OOP concepts, OOP traits, and much more. A basic introduction to UML and class relationships was also provided. In this report, I will select a specific scenario to apply a program to in order to put all of the previous report's knowledge into practice. The UML class diagram will be included in the report for clarity. Finally, a summary of the design pattern that will be used in future projects will be provided. CHAPTER 2 – SCENARIO ANALYSIS. I. Scenario. My friend has lately asked me to help them with a music disc management platform for their business. I intend to develop an app that will keep the list of music discs available in the shop. This software allows users to add new discs by entering information about the music disc such as the ID, name, artist, description, year, and price. Additionally, the system contains customer- required tasks such as adding, removing, updating, and searching for music disc information.

II. Class Diagram. Figure 1 : Class Diagram. This is a class diagram including four classes: MusicDisc(Parent Class), EdmMusicDisc(Children Class), PopMusicDisc(Children Class) and MusicDiscShop which contains CRUD function.

Figure 3 : MusicDisc Class Diagram.  Class EdmMusicDisc is the class which is inherits from MusicDisc class, this class contains Price which is overrides the property Price from class MusicDisc and it also contains three methods GetTitle(), GetType() and DisplayMusicInfo() which is overrides the abstract method abstract from class MusicDisc. Figure 4 : EdmMusicDisc Class Diagram.

 Class PopMusicDisc is the same as class EdmMusicDisc because it also inherits from class MusicDisc. Figure 5 : PopMusicDisc Class Diagram.

  1. MusicDisc Class.  Class Diagram:

methods GetTitle(), GetType() and DisplayMusicInfo() which is overrides the abstract method abstract from class MusicDisc.

  1. PopMusicDisc Class.  Class Diagram. As previously stated, this is also the child class of MusicDisc and this class is the same as EdmMusicClass because it also inherits everything in parent class (MusicDisc Class).
  2. MusicDiscShop Class.  Class Diagram.

As previously stated, because it has a list of books and a CRUD function, the MusicDiscShop class is critical to the overall software. Here is the explanatory specification:  MusicDiscs: this is the list of items that have a music disc within.  CheckID(): Because each music disc's id is unique, I wrote this method to check if the id is duplicated or not; if duplicated, the user will be prompted to provide the other id to prevent having two duplicated ids in the 'musicDiscs' list.  AddMusicDisc(): this is the method to add more disc into the list.  PrintAllDisc(): this is the method to display all of the disc that exist in the list.  PrintAllEdm(): this is the method to display all of the EDM music disc that exist in the list.  PrintAllPop(): this is the method to display all of the POP music disc that exist in the list.  UpdateById(): It is difficult to update music discs by name or artist since they can be duplicated, but each disc's id is unique, thus I created this method to update music discs by id.  DeleteById(): This method is the same as Update because it is also difficult to remove disc by name or artist since they can be duplicated. It would be rather amusing if I opted to remove the disc by name because I may delete the wrong disc because there are many songs with the same name in the world nowadays, but each disc's id is unique, thus I created this method to delete music discs by id.  GetMusicDiscById(): As I mentioned from update and delete method that each disc's id is unique, so I designed this method to help users discover the music disc in the most convenient way possible.  GetMusicDiscByName(): Each music disc has its own name, but their names can be the same, so I created this method to find discs by their

CHAPTER 3 – IMPLEMENTATION.

I. Code. In this section, I will demonstrate the code for my program that corresponds to the aforementioned class diagrams.

  1. MusicDisc Class  Fields: corresponds to the class diagram and comprises id, name, artist, description, year and price. Figure 6 : MusicDisc Class Code 1.

 Constructor: The constructor has parameters id, name, artist, description, year, and price, which correspond to the properties Id, Name, Artist, Description, Year, and Price.  Properties: The code for properties Id, Name, Artist, Description, Year, and Price, is shown below to encapsulate the fields and modify the way they are accessed. Figure 8 : MusicDisc Class Code 3. Figure 7 : MusicDisc Class Code 2.

 Method: The abstract method for get title, get type of each disc and display disc information. Figure 11 : MusicDisc Class Code 6.

  1. EdmMusicDisc.  Constructor: This is a constructor of EdmMusicDisc based on its class parent which is MusicDisc Class.  Properties: This is a property override that allows you to alter the login within it. Figure 12 : EdmMusicDisc Class Code 1.

Figure 13 : EdmMusicDisc Class Code 2.  Method: This is an abstract method that override from MusicDisc Class. Figure 14 : EdmMusicDisc Class Code 3.