Docsity

ASM GREENWICH UNNIVERSITY, Essays (university) of Information Technology

Toggle sidebar
bg1
1
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Prog102: Procedural Programming
Submission date
Date Received 1st
submission
Re-submission Date
Date Received 2nd
submission
Student Name
Nguyen Dang Khanh Hang
Student ID
GCD210581
Class
GCD1103
Assessor name
Phan Thanh Tra
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
Khanh Hang
Grading grid
P4
P5
M3
M4
D2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download ASM GREENWICH UNNIVERSITY and more Essays (university) Information Technology in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Prog 102 : Procedural Programming

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Nguyen Dang Khanh Hang^ Student ID GCD

Class GCD1103^ Assessor name Phan Thanh Tra

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 Khanh Hang

Grading grid

P4 P5 M3 M4 D

Summative Feedback:Resubmission Feedback:

Grade: Assessor Signature: Date:

Lecturer Signature:

  • I. INTRODUCTION:
  • II. IMPLEMENTATION (P4):
      1. Structure of Program:............................................................................................................................................
      1. Functions:
      • 2.1 Function “Enter”:
      • 2.2 Function INPUT:
      • 2.3 Function OUTPUT:
      • 2.4 Function MAXGRADE:
      • 2.5 Function MINGRADE:
      • 2.6 Function MAIN:
      1. Important algorithms:
      • 3.1 Check duplicate ID:
      • 3.2 Check score isn’t valid:
      • 3.3 Find Maxgrade:
      • 3.4 Find Mingrade:
      • ➢ PROGRAM RESULTS:
  • III. TESTING (P5):
  • Figure 1: Declaration of Library Table of Figures
  • Figure 2: Declaration of Global Variables
  • Figure 3: Declaration of Function
  • Figure 4: Declaration of Function
  • Figure 5: Declaration of Function
  • Figure 6: Declaration of Funtion...................................................................................................................................
  • Figure 7: Declaration of Function
  • Figure 8: Main Function
  • Figure 9: Main Function
  • Figure 10: Main Function
  • Figure 11: Function enter
  • Figure 12: Enter information
  • Figure 13: Enter information
  • Figure 14: Show information
  • Figure 15: Maxgrade...................................................................................................................................................
  • Figure 16: Mingrade
  • Figure 17: Function Main
  • Figure 18: Main
  • Figure 19: Main
  • Figure 20: Main
  • Figure 21: Main
  • Figure 22: Main
  • Figure 23: Main
  • Figure 24: Duplicate IDs.............................................................................................................................................
  • Figure 25: Invalid grade
  • Figure 26: Explain Maxgrade
  • Figure 27: Explain Min grade
  • Figure 28: Display menu.............................................................................................................................................
  • Figure 29: choice
  • Figure 30: Enter number of student
  • Figure 31: Enter information
  • Figure 32: Choice 2.....................................................................................................................................................
  • Figure 33: Display student information
  • Figure 34: Choice 3.....................................................................................................................................................
  • Figure 35: Display Maxgrade
  • Figure 36: Choice 4.....................................................................................................................................................
  • Figure 37: Display Mingrade
  • Figure 38: Exit
  • Figure 39: No data with student information
  • Figure 40: No data with find max grade
  • Figure 41: No data with find min grade
  • Figure 42: Wrong number...........................................................................................................................................
  • Figure 43: Wrong number of student
  • Figure 44: Duplicate IDs
  • Figure 45: Wrong grades.............................................................................................................................................
  • Figure 46: Wrong data tyoes
  • Figure 47: Error
  • Table 1: Program result............................................................................................................................................... Table of Table
  • Table 2: Test Plan
  • Table 3: Running the wrong program

Figure 4 : Declaration of Function Figure 5 : Declaration of Function Figure 6 : Declaration of Funtion

Figure 7 : Declaration of Function

  • The last step is to declare main function: Figure 8 : Main Function Figure 9 : Main Function

2.2 Function INPUT:

2.2.1 Enter students information:

  • I use this function to input IDs student. Here, I use a for loop and certain conditions (as shown below) to

make sure that no IDs are duplicated.

Figure 12 : Enter information

  • In the input of student scores, to make sure that the student's score will be between 0 and 10, I used a

while loop so that the program only runs when the score is entered in the allowed range.

Figure 13 : Enter information

2.3 Function OUTPUT:

2.3.1 Show student Information.

  • I use this function to print ID and grade of student. I use for loop assign the value i=1, i<=n ( number of

student) then the student information along with the score will be printed.

Figure 14 : Show information

2.4 Function MAXGRADE:

  • I use this function to find and print the student has highest grade, I build a variable with max, use for

loop and if conditional to find and print the student with the highest score.

  • First, I set max = grade[1]. Then, run the for loop from i=1 to. Check the condition (max< grade[i] ). If

true max = grade[i]. If false, increase i value by 1 unit. Running the loop until i = n, if

grade [i] == max, then print all the IDs of the students with the highest grade.

Figure 15 : Maxgrade

2. 5 Function MINGRADE:

  • I use this function to find and print the student has lowest grade, I build a variable with min, use for loop

and if conditional to find and print the student with the lowest score.

  • First, I set min = grade[1]. Then, run the for loop from i=1 to. Check the condition (min > grade[i] ). If

true min = grade[i]. If false, increase i value by 1 unit. Running the loop until i = n, if

grade [i] == min, then print all the IDs of the students with the lowest grade.

Figure 18 : Main 1

  • I use while with condition that n (number of students) is less than 1 or n is greater than 30 to limit

n. If you enter n outside of the range 1-30, the program will display "The number of students must

be greater than 1 but less than 30:" to ask you to re-enter the correct number.

Figure 19 : Main 2 Figure 20 : Main 3 Figure 21 : Main 4 Figure 22 : Main 5

Figure 23 : Main 6

3. Important algorithms:

3.1 Check duplicate ID:

  • To avoid duplicate IDs, I used for loops and do… while loops. As shown below, q=1 (there are no

duplicate molecules) the screen will allow you to enter the ID but with q=0 (there are duplicate molecules)

the program will ask you " Duplicate ID, enter the ID again”. The loop will continue if you continue to

type incorrectly and end the loop if you enter it correctly.

Figure 24 : Duplicate IDs

3.2 Check score isn’t valid:

  • To make sure that student's scores are entered between 0-10, I used while condition with condition

(grade[i]<0 || grade[i]>10) ( grade less than 0 or grade greater than 10), the screen will display “ Grade had

to be between 0 and 10, grade student %d must be entered again” to ask you to re-enter until you enter

the score within the allowed range, then the loop will end.

➢ PROGRAM RESULTS:

Step Explanation Display on screen

When launching the

program, the screen will

display a menu with the

command “Please input your

choice”.

Here, you will enter the

numbers 1 to 5 to execute the

program.

Figure 28 : Display menu

Press 1, the screen will ask

you to enter “Enter number

of student”. Figure 29 : choice 1

Figure 30 : Enter number of student

When you enter the number

of students between 1-30.

The program will ask you to

enter the student's ID and

score as shown below:

Figure 31 : Enter information

Press 2, the screen will print

out all the students you

entered including IDs and

grades

Figure 32 : Choice 2 Figure 33 : Display student information

Press 3, here the screen will

show the students with the

highest score:

Figure 34 : Choice 3 Figure 35 : Display Maxgrade

Continue with key 4, the

screen will show the students

with the lowest score.

6 11/8/2022 4:55 PM 5 seconds Check input wrong data types. Table 2 : Test Plan

In this section, I run the program and make a few wrong choices:

➢ TEST LOG

Test case Action Test input What I expect Test output Result

1 Choose

number

except

the

number

Choice

  • The

program

runs but

no data

Figure 39 : No data with student information Figure 40 : No data with find max grade Figure 41 : No data with find min grade Pass

2 Choose

numbers

outside

the

range

Choice = 0

  • "Please

input

again and

your

choice

must be

from 1 to

  • Requires

the user to

enter from

1 - 5 to be

able to

Figure 42 : Wrong number Pass

execute

the

program

3 Enter number of student wrong (outside from 1 to

n= 0 - "The

number of

students

must be

greater

than 1 but

less than

  • Require user to choose again Figure 43 : Wrong number of student

Pass

4 Enter the IDs duplicate with the IDs previous one

“Duplicate

ID, enter

the ID

again"

  • Re-enter it again Figure 44 : Duplicate IDs

Pass