














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
hay vcl bà con cô bác ơi vào mà xem mà lấy về nộp
Typology: Study Guides, Projects, Research
1 / 22
This page cannot be seen from the preview
Don't miss anything!















Higher National Certificate/Diploma in Computing
Submission Format:
Unit Learning Outcomes:
Assignment Brief and Guidance:
Figure 1: The brew tea algorithm....................................................................................................................... 5 Figure 2: Algorithm is clear from input to output................................................................................................ 5 Figure 3: Swap number algorithms include 8 steps .............................................................................................. 6 Figure 4: Using available resources to handle problem ........................................................................................ 6 Figure 5: Algorithm can implement in many languages ........................................................................................ 7 Figure 6: Sorting grade of student problem......................................................................................................... 7 Figure 7: How bubble sort algorithm works......................................................................................................... 8 Figure 8: Source code ....................................................................................................................................... 13 Figure 9: Screenshot of the final result (1) ......................................................................................................... 15 Figure 10: Screenshot of the final result (2)........................................................................................................ 15 Figure 11: Software Development Life Circle...................................................................................................... 16 Figure 12: Example about how C# compiler works.............................................................................................. 17
Definition: An algorithm is a procedure or formula used for solving a problem. It contains the steps, which is a set of actions that are executed in a certain order to obtain the desired output. For example: The brew tea algorithm Characteristics of algorithm:
To handle this problem, I will use bubble sort algorithm because it is simpler than other sorting algorithms. Idea of this algorithm is sorting a list of grades of student by repeating the task of swapping two consecutive grade if they are in the wrong order (the latter grade is less than the previous grade) until the sequence grades has been completely sorted by ascending order.
2. Analyze the problem and design the solutions by the use of suitable methods. 2.1. Analyze the problem Input: ➢ - Total of student. ➢ - A list of students included student name and their grade. Output: A list of students is sorted by grade in ascending order. Variables are used: Variable Data type Purpose total integer Store total of student name string array Store student name grade double array Store student grade i, j integer Access each of student name or grade tempName string Store temporary name in order to support swapping value tempGrade double Store temporary grade in order to support swapping value Figure 7 : How bubble sort algorithm works
Structures are used: Structure Purpose If Compare student information to sort For Access each student information
Explain by pseudo code: Step 1: START Step 2: DECLARE tempName, tempGrade, i, j; Step 3: SET i=0; Step 4: WHILE i<total-1 is True, REPEAT step 5 through step 9. Step 5: SET j=i+1; Step 6: WHILE j<total is true, REPEAT step 7 through step 8. Step 7: IF grade[i]> grade[j]: Step 7.1: SET tempName= name[i], SET tempGrade=grade[i]. Step 7.2: SET name[i]=name[j], grade[i]=grade[j]. Step 7.3: SET name[j]=tempName, grade[j]=teampGrade. Step 8: INCREASE j by 1. Step 9: INCREASE I by 1. Step 10: STOP.
3.2. Source code and screenshot of the result final
I use the algorithm that I have analyzed and designed in task 2 to build function sortList: ➢ I declare 2 variable: tempName and tempGrade in order to store temporary name and grade that will support swapping 2 values (name, grade). ➢ I use 2 for-structures combine if-structure with condition (grade[i]>grade[j]) to check if latter grade less than previous grade. In case this condition is true, I will swap variable name[i] and name[j], grade[i] and grade[j]. ➢ The final step: In method Main, I use 3 above functions to handle problem follow order: Read list of students that has not been sorted→display list before sorting→so rtin g list→disp lay list after sorting.
Screenshots of the final results: Figure 9 : Screenshot of the final result (1) Figure 10 : Screenshot of the final result (2)
4. Evaluate how the problem is solved from the designed algorithm to the execution program written by a specific programming language 4.1. Test case: Test case ID Test objective Data Expected result Actual result Evaluation T01 List of The list includes 3 students The list of students The list of Pass students and their information are was sorted by grade in students was after sorting Nguyen Van Long 5 ascending sorted by by grade Bui Thi Linh 3 Bui Thi Linh 3 grade in Dang Van Cuong 9.5 Nguyen Van Long 5 ascending Dang Van Cuong 9. The list includes 5 students The list of students The list of Pass and their information are was sorted by grade in students was Bui Duc Canh 8.1 ascending sorted by Bui Xuan Truong 9.0 Do Duc Thang 4.1 grade in Ha Thi Linh 7.6 Vu Thi Hue 6.6 ascending Do Duc Thang 4.1 Ha Thi Linh 7. Vu Thi Hue 6.6 Bui Duc Canh 8. Bui Xuan Truong 9. Figure 12 : Example about how C# compiler works
The list includes 10 The list of students The list of Pass students and their was sorted by grade in students was information are ascending sorted by Nguyen Trong Hue 8.0 Tang Tien Dat 1.5 grade in Tang Tien Dat 1.5 Nguyen Minh Duc 4.9 ascending Bui Quang Dung 9.6 Ngo Minh Quang 5. Ngo Minh Quang 5.2 Nguyen Thi Thao 6. Cao Viet Anh 7.7 Nong Van Lam 6. Nguyen Minh Duc 4.9 Cao Viet Anh 7. Nguyen Thi Thao 6.1 Nguyen Trong Hue 8. Ha Thu Trang 8.8 Ha Thu Trang 8. Nong Van Lam 6.7 Bui Quang Dung 9. Truong Hai Dang 10.0 Truong Hai Dang 10. 4 .2. Evaluate how the problem is solved from the designed algorithm to the execution program written by a specific programming language Algorithm is ordered steps to solve a certain problem. When we analyze and design the algorithm, we can understand the nature of the problem and the appropriate solution. On the other hand, the computer cannot understand human language, so we have to write it in a suitable programming language that compilers can compile for the computer to understand and run. The program written will be based on the designed algorithm to complete work. Therefore, written algorithm and code variant are closely related in solving problems
5. CONCLUSION Nowadays C# is one of the most popular language in the world, end it coming more and more common. This report gives me a chance to practice with it. In this report, I introduced about C# language, algorithm, SDLC. I made a program for student management using procedural programming. The essential necessities that the problem needs were all successfully delivered and implemented.