1651 Advanced Programming ASM2, Assignments of Information Technology

ASM2 - 1651 - Hope it can help u get pass

Typology: Assignments

2022/2023

Uploaded on 09/12/2023

andrew-2709
andrew-2709 🇻🇳

4.8

(20)

33 documents

1 / 33

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Higher Nationals in Computing
Advanced Programming
ASSIGNMENT 2
Learner’s name: ơng Trng Quí
ID: GBS200716
Class: GCS1005A
Subject code: 1651
Assessor name: NGUYEN VAN SON
Assignment due: Assignment submitted:
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

Partial preview of the text

Download 1651 Advanced Programming ASM2 and more Assignments Information Technology in PDF only on Docsity!

Higher Nationals in Computing

Advanced Programming

ASSIGNMENT 2

Learner’s name: Dương Trọng Quí

ID: GBS

Class: GCS1005A

Subject code: 1651

Assessor name: NGUYEN VAN SON

Assignment due: Assignment submitted:

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 Dương Trọng Quí Student ID GBS Class GCS1005A Assessor name Nguyen Van 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 Quí Grading grid P1 P2 M1 M2 D1 D

ASSIGNMENT 2 BRIEF Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 2 : Advanced Programming Assignment title Application development with class diagram and design patterns Academic Year 2022 - 2023 Unit Tutor Nguyen Van Son Issue date Submission date Submission Format: Format: The submission is in the form of an individual 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/ together with zipped project files. 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.
    1. Introduction:
  • P3 Build an application derived from UML class diagrams.
    1. Scenario analysis:
    • 2.1. Scenario:
    1. Implementation:
    • 3.1. Code:............................................................................................................................................
    • 3.2. Program screenshots:
    • 3.3. Problems during program execution:
  • pattern types. P4 Discuss a range of design patterns with relevant examples of creational, structural and behavioral
    1. What are design patterns?
    • 4.1. Uses of Design Patterns:
    • 4.2. Creational design patterns:
    • 4.3. Structural design patterns:
    • 4.4. Behavioral design patterns:
    • 4 .5. The pros and cons of using design patterns:
  • REFERENCES
  • Figure 1: Class Person Table of Figure:
  • Figure 2: Class Student
  • Figure 3: Class Menu
  • Figure 4: Class Program
  • Figure 5: Add student code (1)
  • Figure 6: Add student code (2)
  • Figure 7: Display student code
  • Figure 8: Search student code
  • Figure 9: Sort student code
  • Figure 10: Edit student code
  • Figure 11: Let student code
  • Figure 12: Delete student code
  • Figure 13: Menu
  • Figure 14: Add new student (1)
  • Figure 15: Add new student (2)
  • Figure 16: Display student list
  • Figure 17: Search student by ID (1)
  • Figure 18: Search student by ID (2)
  • Figure 19: Search student by Name (1)
  • Figure 20: Search student by Name (2)
  • Figure 21: Sort Student List by Name
  • Figure 22: Sort Student List by Age
  • Figure 23: Edit student
  • Figure 24: After Edit
  • Figure 25: Let student study status (1)
  • Figure 26: Let student study status (2)
  • Figure 27: Delete student
  • Figure 28: After Delete
  • Figure 29: error occurred
  • Figure 30: After fixing the error
  • Figure 31: Design patterns
  • Figure 32: Creational design patterns
  • Figure 33: Example creational - Abstract Factory Design Pattern
  • Figure 34: Structural design patterns
  • Figure 35: Example Structural - Composite Design Pattern
  • Figure 36: Behavioral design patterns
  • Figure 37: Example Behavioral - Interpreter pattern

ASSIGNMENT 2 ANSWERS

Group:

Trần Ngọc Gia Hoàng – GCS Dương Trọng Quí – GBS

1. Introduction:

In assignment 1, our group presented the effectiveness of UML diagrams in object-oriented analysis and design (OOAD) and introduced some Design patterns in use. Therefore, in this assignment 2, our group will present the application of OOAD and design patterns in a scenario, as well as an advanced discussion of the scope of design patterns. Building an application utilizing the C# programming language to manage student information and activities in a learning environment. To achieve these goals, we have decided to create a program encompassing functionalities such as adding and displaying student information, sorting, and searching for students. We intend to equip my program with a straightforward and user-friendly interface, utilizing the console interface. Users will interact with the program via the keyboard. The program will be developed using the C# programming language and Visual Studio IDE.

P3 Build an application derived from UML class diagrams.

2. Scenario analysis:

2.1. Scenario: Student management at the University of Greenwich is becoming more and more challenging as it grows. We must develop software that can control student behavior in the classroom. The software enables the management of student data such as ID, name, age, phone number, email, and grades. The application for this project is built on the principles of object-oriented programming, with C# serving as the main language. We also highlight the greatest OOP design and programming patterns in this study and provide the best software development methodology as a result. The OOAD application will be implemented using the UML class diagram design, and the classes in the source code will follow the OOAD principles.

3. Implementation:

3.1. Code: This code allows the manager to manage a student management system by adding, editing, searching, sorting, letting status student and deleting student from a student table, as well as displaying all students in the table.

Figure 3 : Class Menu The Menu will include the following main functions:

  1. Add Student.
  2. Display Student List.
  3. Search Student by ID.
  4. Search Student by Name.
  5. Sort the Student List by Name.
  6. Sort the Student List by Age.
  7. Edit Student Information.
  8. Let Student Study Status.
  9. Delete Student by ID.
  10. Exit.
    • Class Program : the main class that contains the execution-controlling Main() function. The Program class, which also manages the user's selection, displays the menu. Additionally, it arranges student lists and does tasks including adding, displaying, searching, sorting, and modifying student data. There is no relationship between the remaining classes on the chart and the Program class.

Figure 4 : Class Program

Figure 6 : Add student code (2) The section that requires the user to enter the student's score, similar to age, uses a do-while loop to check the validity of the score. Use double. TryParse() to check the validity of the input and grade values should not be greater than 10. If the score is invalid, the corresponding error message will be displayed.

  • Display student code and description: Figure 7 : Display student code Use a foreach loop to loop through the student list and print out each student's information. Each student is displayed in a row of data as a column, information such as ID, name, phone number, grade, and age are aligned along the corresponding column. Use format strings ({student.ID,-9}, {student. Name,-18}, etc.) to align and position each information correctly.
  • Search student code and description:

Figure 8 : Search student code SearchStudentByID() The Find() function is used to find students in the students list with the condition s.ID == id. If found, the corresponding Student object will be returned and assigned to the student variable. If the other student is null, i.e. the student has been found, the student's information will be displayed, including ID, name, age, number The Find() function is used to find students in the students list with the condition s.ID == id. If found, the corresponding Student object will be returned and assigned to the student variable. If the other student is null, i.e. the student was found, the student's information will be displayed, including ID, name, age, phone number, and grades. If the student with the given ID is not found, the message that "Student with the given ID was not found." will be displayed.điện thoại và điểm. If the student with the given ID is not found, the message that "Student with the given ID was not found." will be displayed. SearchStudentByName() The FindAll() function is used to find all students in the students list whose names contain the name string. The StringComparison.OrdinalIgnoreCase parameter allows lowercase insensitive searches. If any students are found, the foundStudents list will contain students who meet the search eligibility.

Using the parameter of the Sort() method, a lambda expression is passed to define how the two students compare (s1 and s2). In this case, s1. Age.CompareTo(s2. Age) is used to compare the ages of two students. The CompareTo() method returns a negative value if s1. Age is less than s2. Age, return 0 if equal, and return a positive value if s1. The age is greater than s2. Age. After the list has been sorted, the message "Student list sorted by age:" will be displayed. The DisplayStudents() function is called to display a list of students sorted by age.

  • Edit student code and description: Figure 10 : Edit student code The EditStudent() function allows users to edit a student's information based on the student's ID Users are required to enter the ID of the student to be edited.

The Find() function is used to find students in the students list with corresponding IDs. If found, the corresponding Student object will be assigned to the student variable. If the other student is null, i.e. the student has been found, the user will be asked to enter new information for the student. Console.WriteLine line($"Editing Student ID: {student.ID}"); print out a message that the student's information with the corresponding ID is being edited. The user is required to enter new information: name, age, phone number and points. Use int. TryParse() to check the validity of the age of entry. If valid, the user will be asked to enter a new phone number and a new point. Use double. TryParse() to check the validity of the entry point. If valid, student information will be updated with new information and the message "Student information updated successfully." will be displayed. If the age or score is invalid, an error message will be displayed accordingly. If the student with the given ID is not found, the message that "Student with the given ID was not found." will be displayed.

  • Let student code and description: Figure 11 : Let student code The LetStudentStudy() function allows users to allow a student to study by entering the student's ID. Users are required to enter the ID of the student who needs permission to study.

If the student with the given ID is not found, the message that "Student with the given ID was not found." will be displayed. 3.2. Program screenshots: Menu: Student management menu interface. Figure 13 : Menu Add new student: Select button 1 and add student information to the program. Figure 14 : Add new student (1) Figure 15 : Add new student (2) Display student list: Added students will be saved to the program and when button 2 is selected, all existing and newly added students will be displayed.

Figure 16 : Display student list Search student by ID: Button number 3 will let users search for students by ID. Figure 17 : Search student by ID (1) Figure 18 : Search student by ID (2) Search student by Name: Button number 4 will let users search for students by Name. Figure 19 : Search student by Name (1) Figure 20 : Search student by Name (2) Sort Student List by Name: Button number 5 will allow users to sort students alphabetically.