Assignment 2 Front Sheet: Qualification BTEC Level 5 HND Diploma in Computing

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 0: Procedural Programming

Submission date 24/08/2020 Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Hoàng Minh Trọng Student ID GCD191130

Class GCD0708B Assessor name SRIKANTH RAJ U KANDUKURI

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:

Grade: Assessor Signature: Date:


Lecturer Signature:
TABLE OF CONTENTS

Table of figure ..................................................................................................................................... 2


Table of table ...................................................................................................................................... 3
Chapter 1 : Scenario introdution problem ............................................................................................. 4
1. Scenario.............................................................................................................................................. 4
2. Report Objective ................................................................................................................................. 4

Chapter 2: Implementation and results ................................................................................................ 5


1. C source files in the design program..................................................................................................... 5
A. Main variables ............................................................................................................................................................. 5
B. variables main function ................................................................................................................................................... 5

C. Result of Scenario ............................................................................................................................. 12


D. Test data case ................................................................................................................................... 14

Chapter 3 : Summary ......................................................................................................................... 16


1. Evaluation......................................................................................................................................... 16
2. Evaluation code variant in implementation ........................................................................................ 16
A. If-Else : ....................................................................................................................................................................... 16
B. For ................................................................................................................................................................................. 17
C. While ............................................................................................................................................................................. 17

3. analyze the results from test cases .................................................................................................... 18


4. Review and summary ........................................................................................................................ 18
A. Pros ........................................................................................................................................................................... 18
B. Cons............................................................................................................................................................................... 18
C. Betterment .................................................................................................................................................................... 18
D. overall evaluasion ..................................................................................................................................................... 18

1
TABLE OF FIGURE

Figure 1: Main variables ................................................................................................................................................................. 5

Figure 2: InputID ............................................................................................................................................................................. 6

Figure 3: InputGrade ....................................................................................................................................................................... 6

Figure 4 : CheckID ........................................................................................................................................................................... 7

Figure 5: ListStudent ....................................................................................................................................................................... 8

Figure 6: Single Student .................................................................................................................................................................. 8

Figure 7: Display List Student .......................................................................................................................................................... 8

Figure 8: Lowest Student ................................................................................................................................................................ 9

Figure 9: Highest Student................................................................................................................................................................ 9

Figure 10: Option of user .............................................................................................................................................................. 10

Figure 11: Main of Scenario .......................................................................................................................................................... 10

Figure 12: Main of Scenario .......................................................................................................................................................... 11

Figure 13: Main of Scenario .......................................................................................................................................................... 11

Figure 14: Main of Scenario .......................................................................................................................................................... 12

Figure 15: Enter StudenID ............................................................................................................................................................. 13

Figure 16: Enter Grade .................................................................................................................................................................. 13

Figure 17: Print all student IDs togerther with their grades ......................................................................................................... 13

Figure 18: Print studentIDs has highest grades ............................................................................................................................ 14

Figure 19: Print studentIDs has lowest grades .............................................................................................................................. 14

Figure 20: If-Else............................................................................................................................................................................ 16

2
Figure 21: Flowchart If-Else ........................................................................................................................................................... 16

Figure 22: For loop syntax ............................................................................................................................................................. 17

Figure 23: Example While ............................................................................................................................................................. 17

TABLE OF TABLE

Table 1: Data Case ......................................................................................................................................................................... 15

3
CHAPTER 1 : SCENARIO INTRODUTION PROBLEM

1. SCENARIO

• A math teacher wants to manage grades of a class. He asks you to help him to write a small application
to do that. He needs to enter student IDs, student’s grades and store these information into 2 separate
arrays (integer array for IDs and float array for grades). Then he needs to print all student IDs together
with their grades. Finally, he needs to know which student has highest grade and lowest grade. Your
program should be menu based with the options above. When an option is done, the program should
go back to the main menu so he can choose another option. There should be an option to quit program.

2. REPORT OBJECTIVE

4
• The main purpose of the essay is to provide a basic explanation of procedural programing. This report
will help teachers to manage student ID and gradesfor all students of the class. In addition, it can help
teachers with many options such asadding more student, search for student informationand find the
highest or lowest grade students in the classroom.

CHAPTER 2: IMPLEMENTATION AND RESULTS

1. C SOURCE FILES IN THE DESIGN PROGRAM.

A. MAIN VARIABLES

Figure 1: Main variables

B. VARIABLES MAIN FUNCTION

a. Function inputID

5
Figure 2: InputID

- Local : int StudentID[5].

b. Function inputGrade

Figure 3: InputGrade

- Local : float grade[5].


c. Function CheckID

6
Figure 4 : CheckID

d. Function enter liststudent

7
Figure 5: ListStudent

- Local : int I,n


- Parameter : student listsStudent
e. Function enter Single Student

Figure 6: Single Student

- Local : student stdTmp, char continuous


- Parameter : student listStudent, int count
f. Function display List Student

Figure 7: Display List Student

8
g. Function find the lowest student.

Figure 8: Lowest Student

h. Function find the highest student.

Figure 9: Highest Student

i. Option of user.

9
Figure 10: Option of user

j. Main of Sceario

Figure 11: Main of Scenario

10
Figure 12: Main of Scenario

Figure 13: Main of Scenario

11
C. RESULT OF SCENARIO

a. Main of scenario

Figure 14: Main of Scenario

12
b. Enter StudenID

Figure 15: Enter StudenID

c. Enter Grade

Figure 16: Enter Grade

d. Print all student IDs togerther with their grades

Figure 17: Print all student IDs togerther with their grades

13
e. Print studentIDs has highest grades

Figure 18: Print studentIDs has highest grades

f. Print studentIDs has lowest grades

Figure 19: Print studentIDs has lowest grades

D. TEST DATA CASE

Stt Test step Test case Expected results True resutls Status

1. Enter studentiD StudentID1 : 1 PASS


StudentID2 : 2
StudentID3 : 3
StudentID4 : 4

1 2. Enter studentGrade Grade of student1 : 8


Grade of student2 : 9.5
Grade of student3 : 7
Grade of student4 : 7.5
Grade of student5 : 8
3. Submit

14
1. Choose your option 1 : StudentID 1 : 8.00 StudentID 1 : 8.00 PASS
Print all student IDs StudentID 2 : 9.50 StudentID 2 : 9.50
togerther with their grades StudentID 3 : 7.00 StudentID 3 : 7.00
StudentID 4 : 7.50 StudentID 4 : 7.50
StudentID 5 : 8.00 StudentID 5 : 8.00
2
2. Submit

1. Choose your option 2 : Student ID 2 get 9.50 Student ID 2 gets 9.50 PASS
Print studentIDs has points, the person with points, the person
highest grades the highest grade! with the highest
3 grade!

2. Submit

1. Choose your option 3: Student ID 3 get 7.00 Student ID 3 get 7.00 PASS
4 Print StudentIDs has points, the person with points, the person
lowest grades the lowest grade! with the lowest grade!

1. Enter StudentIDs StudentID 1 : GCD191130 StudentID 1 : GCD191130 …Program finished FAIL


5 with exit
Press ENTER to exit
2. Submit console

1. Enter Student Grade Grade of student : Seven …Program finished with …Program finished PASS
6 exit with exit
Press ENTER to exit Press ENTER to exit
2. Submit console console

7 1. Enter SudentID StudentID1 : 1 StudentID1 : 1 …Program finished FAIL


StudentID2 : 2 StudentID2 : 2 with exit
StudentID3 : 3 StudentID3 : 3 Press ENTER to exit
StudentID4 : 4 StudentID4 : 4 console

2. Enter StudenGrades ( Grade of Student : Six Grade of Student : Six


Char )

3. Submit

Table 1: Data Case

15
CHAPTER 3 : SUMMARY

1. EVALUATION
- First, write console and enter sequentially
- Insert into array type int: StudentID.
- Insert into array type float : Grade
For Example :

StudentID 1 2 3 4 5

Grade 6 5 6 9 10

- Requirement 1: print out all student + grade : Then run “for” loop, because the 2 arrays are of equal length. So
each student's index will correspond to the index of grade. As in the example: position 0 (index = 0) will be student
with id = 1 and grade = 3, position 1 (index = 1) will be student with id = 2 and grade = 5.

2. EVALUATION CODE VARIANT IN IMPLEMENTATION

A. IF-ELSE :
- If else structure is a component that is used in almost every software program

Figure 20: If-Else

- I use this structure in this scenario because: If the condition is true then it will continue, and if it is false, it will
Break.
- Flowchart example :

Figure 21: Flowchart If-Else

16
B. FOR

- For loops have a more complex syntax, but are more concise than while or do-while loops when used.
- For loop can completely replace while loop.
- For loops are often used for situations where the number of workload iterations is known in advance.
- For loop syntax :

Figure 22: For loop syntax

C. WHILE
- The while loop is defined by the while keyword. Once the while loop is executed, the while conditional expression
is evaluated. If the conditional expression evaluates to true, the statements in the while loop will be executed.
- For example :

Figure 23: Example While

17
3. ANALYZE THE RESULTS FROM TEST CASES

- As you can see, during the test case, some unnecessary errors occurred. That is, instead of
typing numbers to display scores on the screen, I replaced it with words for testing. Example:
We entered the letter Seven instead of the number 7, but the system immediately Exit.
Likewise we tried with entering student ID, and the results were the same (Stt 6, 7 Table 1). In
addition to the above errors, the program runs very smoothly and with the correct process. All
tests achieved the expected results without any errors. In the future we will update new
features suitable for student administrators.

4. REVIEW AND SUMMARY

A. PROS

- In my opinion, this program is designed for teachers, it is easy to use, easy to find students,
enter students, or fill in students. It has everything a teacher needs to get the most out of it. I
have designed for the program a really eye-catching menu and easy to use as easy as possible. I
added to the menu specific options such as: EnterStudentID, EnterStudentGrade, Student have
highest grade, lowest grade. For example: If you want to find the student with the highest
score, simply press 2 on the menu to display it (as shown in Figure 18). In summary, This
program can help teachers or those who need to use it as best as possible.

B. CONS

- Everything has pros and cons, although I have done the best I can, there are still some points
that I am still not satisfied, that is I still cannot make the display all the students together. for a
while, and have yet to specifically select a student and display that student's specific scores.
What I regret the most is that I still cannot print out student scores in words. For example: If I
enter the score in words Seven, the system will immediately Exit.

C. BETTERMENT

- In the future, I will update the program with new features such as: Enter the number of
students' scores from low to high or high to low, delete students, add students, and special
Especially, to select students with equal scores.

D. OVERALL EVALUASION

18
- In conclusion, this program is really the program that I did the best I could. Although it may lack the special
features but the current ones that I did, it. can be of help to teachers and student administrators. Although the
program still has many bugs, but in the future I will definitely fix it.

19

You might also like