0% found this document useful (0 votes)
48 views16 pages

PROG102 Assignment 2 Frontsheet DUNVGCH - 1

The document is the front sheet for Assignment 2 of a BTEC Level 5 HND Diploma in Computing unit on Procedural Programming. It includes information such as the student's name and ID, the class, assessor name, a declaration that the work is the student's own, and sections for feedback and grading.

Uploaded by

Thang Vu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views16 pages

PROG102 Assignment 2 Frontsheet DUNVGCH - 1

The document is the front sheet for Assignment 2 of a BTEC Level 5 HND Diploma in Computing unit on Procedural Programming. It includes information such as the student's name and ID, the class, assessor name, a declaration that the work is the student's own, and sections for feedback and grading.

Uploaded by

Thang Vu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title PROG102: Procedural Programming

Submission date 24/06/2022 Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Nguyễn Văn Dự Student ID GCH210976

Class GCH1104 Assessor name Đặng Trần Long

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 Dự

Grading grid

P4 P5 M3 M4 D2
 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:
Table of Contents
I. Introduction ................................................................................................................................................. 4
1. Scenario .................................................................................................................................................. 4
2. Problem................................................................................................................................................... 4
3. Solution ................................................................................................................................................... 4
II. Implementation .......................................................................................................................................... 4
1. Explain structure of program .................................................................................................................. 4
2. Explain each function and how functions are used in program ............................................................. 5
3. Program’s code ................................................................................................................................... 10
III. Show and Testing .................................................................................................................................... 12
1.Show ...................................................................................................................................................... 12
2. Test........................................................................................................................................................ 15
IV. Evaluate ................................................................................................................................................... 16
I. Introduction

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. Problem
• Managing student information is a complicated and error-prone job if managed in the traditional
way.
• I need to find a way to create a system that solved the disadvantages of the old method.
• - The program should have main function to enter, print, find min, max and exit.

3. Solution
• Using procedural programming to write program
• Program need an interface to show options, variables and array to enter information: name, ID,
grade.
• Create separate functions to input, print, find highest and lowest score.

II. Implementation
1. Explain structure of program
• Declare section
- Declaration library
<stdio.h>: Provide the ability to enter, printf, scanf,…

- Struct:
This section declares global variables to store information related to student.
int n: to store the number of students.
char name: char uses two-dimensional arrays to store name of student.
int ID: integer array for ID.
float grade: float array for grade.
-Declare functions

• Main
I use switch-case for selecting option and perform function.

2. Explain each function and how functions are used in program

• Function input student’s data.


- Using do-while commands to help user check if they have entered wrong data like if user entered
the number of students < 0, the program will display and let use enter again.
- Start a loop that feeds the input statement into the previously generated information arrays until
the number of times the loop is equal to the number of students that entered above.
• Function print student’s data.
Like input data, I use a loop to print data of student. It will display as:
1. Name: x1 ID: x2 Grade: x3.
2….
n. Name: xn1 ID: xn2 Grade: xn3.

• Function find highest score


In this function, I declared 2 local variables:
Float max: to store highest score.
int maxID: to store ID of student who have highest score.
First assign the max value to equal the value of array i = 0, then compare with the value of array
i=1, if array i=0 is less than value i=1 then give max = grade[1] , if not the value is max= grade[0].
then calculate i=i+1 and then compare to the grade[n] to find the highest score.
Then I will print the highest score and their ID follow by:
Highest score: x || ID: xx

• Function find lowest score


To find the lowest grade, we use the for-loop function like finding the highest score.
I declared 2 local variable:
Float min: to store lowest score.
int minID: to store ID of student who have lowest score.
First assign min value equal to the value of array i = 0, then compare with the value of array i=1, if
array i=0 is greater than value i=1 then give min = grade[1] , otherwise min= grade[0]. then
calculate i=i+1 and then compare to the grade[n] to find the lowest score.
• Function menu
This function will display options to user can track easily.

• Main function
Firstly, I call menu function to print options. Then I declare a variable option, it’s purpose to use
into switch case. When menu was displayed, program will display cases and scan option to act
functions were called.
Case 1: program will call function input data
Case 2: program will call function find highest core
Case 3: program will call function find lowest score
Case 4: program will call function print data
Case 0: program will return 0 to end
3. Program’s code
III. Show and Testing
1. Show
Display menu

Input student’s Data


Print student’s data
Find highest score

Find lowest score


Exit program

2. Test

Test case Plan How Data Expected Actual Evaluate


result result
1 Input Try to Characters(a,#,@,…) invalid Program fail
option input bad got error
data, Decimal data invalid Program fail
typical exit
data Integer data Data Program pass
accepted continue
2 Input the Try to Characters(a,#,@,…) invalid Program fail
number of input bad got error
students data, Decimal data invalid Program fail
typical continue
data. Integer data Data Program pass
accepted continue
3 Input name Try to Characters(a,#,@,…) Data Program pass
input bad accepted continue
data, Decimal data Data Program pass
typical accepted continue
data. Integer data Data Program pass
accepted continue
4 Input ID Try to Characters(a,#,@,…) Invalid reinput pass
input bad Decimal data invalid reinput pass
data, Integer data Data Program pass
typical accepted continue
data.
5 Input grade Try to Characters(a,#,@,…) Invalid reinput pass
input bad Decimal data Data Program pass
data, accepted continue
typical Integer data Data Program pass
data. accepted continue
6 Finding Input 3 Grade 1:6 Highest Highest pass
highest grade Grade 2: 3.7 grade: 9 grade: 9
grade Grade 3: 9
7 Finding Input 3 Grade 1:6 lowest Highest pass
lowest grade Grade 2: 3.7 grade: 3.7 grade: 9
grade Grade 3: 9

IV. Evaluate

After testing and checking my application, I found that:


Advantages:
- Easy to use, friendly interface for user.
- Program was split to functions so others can add features, fix program easily.
Overall, it is simple but it has satisfied all the requirements set by the user.
Disadvantages:
- Application will error when entering wrong data types.
- It has few features, if user has more request, they will be disappointed.
- There are many bugs that I haven't figured out yet.
In conclusion, I have learnt many lessons. I realized that I have many shortcomings and lack of
experience in handling problems like this because it takes longer than expected. And this will help me
improve my self in near future.

You might also like