Professional Documents
Culture Documents
Assignment 2 Front Sheet: Qualification BTEC Level 5 HND Diploma in Computing
Assignment 2 Front Sheet: Qualification BTEC Level 5 HND Diploma in Computing
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
Grading grid
P4 P5 M3 M4 D2
Summative Feedback: Resubmission Feedback:
2.1
Contents
CHAPTER 1: IMPLEMENTATION (P4)............................................................................................................................. 3
1. INTRODUCTION ..................................................................................................................................................... 3
1.1 Scenario .......................................................................................................................................................... 3
2.2 Solution ........................................................................................................................................................... 3
2. IMPLEMENTATION ................................................................................................................................................ 3
2.1 Library Declaration.......................................................................................................................................... 3
2.2 Variables and Data Types ................................................................................................................................ 5
2.3 Display Menu .................................................................................................................................................. 5
2.4 “Input Student Information” Function ........................................................................................................... 6
2.5 “Display List Of Student” Function.................................................................................................................. 6
2.6 “View Highest Student Grade” Function ........................................................................................................ 7
2.7 “View Lowest Student Grade” Function ......................................................................................................... 7
3. ALGORITHMS ........................................................................................................................................................ 8
4. PROGRAM RESULT ................................................................................................................................................ 9
CHAPTER 2: TESTING (P5) ........................................................................................................................................... 11
Figure 1: Library Declaration......................................................................................................................................... 3
Figure 2: Variables and Data Types............................................................................................................................... 5
Figure 3:Display Menu .................................................................................................................................................. 5
Figure 4: Menu Option .................................................................................................................................................. 6
Figure 5: Student Information ...................................................................................................................................... 6
Figure 6: Display Student .............................................................................................................................................. 7
Figure 7: View Highest Student Grade .......................................................................................................................... 7
Figure 8: View Lowest Student Grade .......................................................................................................................... 7
Figure 9: Example Do While Loop ................................................................................................................................. 8
Figure 10: Example Switch Case ................................................................................................................................... 9
Figure 11: Example If Else conditional statement ........................................................................................................ 9
Figure 12: Program Menu ........................................................................................................................................... 10
Figure 13: Select Option 1........................................................................................................................................... 10
Figure 14: Select Option 2........................................................................................................................................... 10
Figure 15: Select Option 3........................................................................................................................................... 10
Figure 16: Select Option 4........................................................................................................................................... 11
Figure 17: Select Option 5........................................................................................................................................... 11
1. INTRODUCTION
1.1 Scenario
I received a request from a teacher to create a program that can manage student information. In the
program, teachers can view and enter student information. The program also has a place to store student
information such as grades, IDs. Besides, the program can also help teachers find out the students with the highest
scores and the students with the lowest scores.
2.2 Solution
In assignment 1, I introduced procedural programming, some information about the commands I use to
create the program, and explained how they work so that the program can store IDs and scores. students and
output to the screen. I will now go into more depth about how I created this program, including graphics, tables,
and most importantly, detailing the main command line functions.
2. IMPLEMENTATION
2.1 Library Declaration
The Data Type that I use in this program is integer and real number, it is abbreviated as "int" and "float".
• n : The variable “n” I use in the program is used to store the number of students entered.
• choice: The “choice” variable I use in the program is used to save the choice in the menu and
execute the appropriate cases.
• MaxGrade, MinGrade, HighestGrade,LowestGrade: These variables are used to store the price
when performing the search for the student with the highest and lowest scores in the program.
• StudentID[100]: It is used to store a list of student IDs.
• StudentGrade[100]: It is used to store a list of student’s grades.
The viewmenu() function is created using the printf() statement. It outputs menus and options that the user can
choose to use. I also use a Switch case so that the program can run the requests the user wants and ignore the
others. Besides, I use While loop to be able to repeat the commands requested by the user until the user wants to
end the program.
Figure 4: Menu Option
I create the for loop with printf() function to repeat printing out One by one value of 2 arrays StudentID
and StudentGrade until the loop equal to the number of students that the user entered.
%d and %f represent StudentID[i] and StudentGrade[i]. Besides, I also use margins to make printing
more accurate. Example "%5d%21.1f".
While and do-while loops are used in a program to execute program choices. It saves us from having to rewrite many
times, making the program more complicated. When the condition is met, the program will pause the loop and
move on to the next step. For example in the exercise, if a student's score and ID is the highest that matches the
given condition, it will output that student's information screen.
For the switch case statement, it will act like an if-else structure, but in some cases there are multiple
conditional statements to execute. It would be simpler to generate and read our code if we used a
switch case. It also takes less time in rewriting multiple times. There will be a large number of options in
the program, from 1 to 5. There is a default case for switch cases that will be run if none of the cases
match the value of the condition and generate the error indicates that the user has provided an
incorrect condition.
Besides, it is also indispensable for the if else conditional statement. In the program it helps us to find the
student with the highest and lowest grade.
4. PROGRAM RESULT
This is the program's menu, which has been created with an intuitive interface suited for all novice users.
The relevant data input will be made by the user. The system will initially display all five function
possibilities to you; select one of them to initiate the function. Your job is to enter the appropriate request.
Figure 12: Program Menu
A notification asking the user to enter a number of pupils shows on the screen when the user chooses
option 1. User-selected choices and statements for student information entry are shown.
When the user chooses option 2, the program will display on the screen all the student's information
including the student's grade and ID.
When the user does option 3, the program will display on the screen the student with the highest grade.
When the user selects option 5, the program will be closed. Enter any key to exit the program.
Test Pass
Test Content Test Data Expected Actual Result
Case /Fail
Enter wrong Show enter
Input a
choice (choice error and re-
1 number other PASS
<=0 or choice > enter
than 1,2,3,4,5
5)
Enter any Show enter
Enter wrong
negative error and re-
2 StudentID FAIL
number or any enter
value
letter
Enter a
Show enter
Enter wrong number
error and re-
3 Grade greater than PASS
enter
value 10 or less than
0
Input a The program
Enter the
number returns to re-
wrong number
4 greater than enter the FAIL
range of
100 or less number of
students
than 0 students
The program
reported a
Enter duplicate Enter
mistake and
5 student ID duplicate ID in FAIL
re-entered
entered before a program
the student
ID
The program
Enter student
correctly
7 Check ID ID that match PASS
received the
the program
input data
Check and
output all The program
Enter student
student correctly
9 data and select PASS
information outputs all
option 2
input data
The program
Check the Enter student outputs the
student with information correct
10 PASS
the highest and select student with
grade option 3 the highest
grade
The program
Check the Enter student outputs the
student with information correct
11 PASS
the lowest and select student with
grade option 4 the lowest
grade