Docsity Assignment 1 Programming Btec C
Docsity Assignment 1 Programming Btec C
C#
Programming Paradigms
Greenwich University (GU)
21 pag.
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.
Grading grid
P1 M1 D1
Characteristics of
algorithm:
+ Unambiguous: The algorithm should be explicit and straightforward. Each of its processes as
well as their inputs and outputs, should be obvious and lead to just one conclusion.
+Finiteness: Algorithm must handle the problem after doing number of certain steps.
provided.
Figure 4-Using available resources to handle problem
+ Independent: Algorithm does not base on certain programming language. It can be implemented
in many different programming languages.
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.
Structure Purpose
If Compare student information to sort
For Access each student information
Flowchart
-In detail, my program will read unsorted list of students that included name and grade from keyboard,
and then I display this list on console screen. After that, I sort this list by grade and display it on console
screen.
Explain:
The first step: I declare global 3 variables: total, string[] name and double[] grade.
The next step: I use procedural programming skill to build 3 functions: readList,
printList and sortList.
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→sorting
list→display list after sorting.
4. Evaluate how the problem is solved from the designed algorithm to the
execution program written by a specific programming language
Test case:
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.6
Vu Thi Hue 6.6 Bui Duc Canh 8.1
Bui Xuan Truong 9.0
Document shared on https://www.docsity.com/en/assignment-1-programming-btec-c/7733496/
Downloaded by: tin-ngo-1 (tindeptry1357@gmail.com)
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.2
Ngo Minh Quang 5.2 Nguyen Thi Thao 6.1
Cao Viet Anh 7.7 Nong Van Lam 6.7
Nguyen Minh Duc 4.9 Cao Viet Anh 7.7
Nguyen Thi Thao 6.1 Nguyen Trong Hue 8.0
Ha Thu Trang 8.8 Ha Thu Trang 8.8
Nong Van Lam 6.7 Bui Quang Dung 9.6
Truong Hai Dang 10.0 Truong Hai Dang 10.0
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