You are on page 1of 13

ASSIGNMENT 2 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 Doan Vo Quy Student ID GCH210660

Class GCH1101 Assessor name

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 Quy

Grading grid

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

2.1

Grade: Assessor Signature: Date:


Lecturer Signature:
Table of Contents
A. Implementation .......................................................................................................................................... 4
I. Program explanation ................................................................................................................................ 4
II. Screenshots of the program running ...................................................................................................... 9
B. Testing .................................................................................................................................................... 11
I. Test plan ................................................................................................................................................ 11
II. Conclusion ........................................................................................................................................... 11
C. Evaluation ............................................................................................................................................... 12
I. Implementation
1. program explanation
Line 1: brings in the standard input/output library.

Line 2: create a structure (a user defined data type) called student, used to store different type of variable
of the student's attributes

Line 3: declares an array of 100 character.

Line 4: declare an integer variable named id.

Line 5: declare a float variable named grade.

Line 6: end the structure with a semicolon.

Line 7: declare a void function named ‘accept’ with the purpose of letting users enter student information
with many different attributes.

Line 8: declare an integer variable named i.

Line 9: this introduces a for-loop that will iterate i through the values 0 through s-1.

Line 10: print the string inside quotations.

Line 11: print the string inside quotations.

Line 12: read input data that is integer.

Line 13: print the string inside quotations.

Line 14: read input data that is string.

Line 15: print the string inside quotations.

Line 16: read input data that is real number.

Line 17: end the first for-loop.

Line 18: this closes the void accept() function.

Line 19: declare a void function named ‘display’ to print out all student information.

Line 20: declare an integer variable named i.

Line 21: print the string inside quotations.

Line 22: this introduces a second for-loop that iterates in the same way as the first.

Line 23: print the string inside quotations.

Line 24: end the second for-loop.


Line 25: this closes the void display() function.

Line 26: declare int function that return a value named findMax to find the greatest value.

Line 27: open the body of the ‘int findMax’ function.

Line 28: assign 1 value in array named list[0].grade to ‘max’.

Line 29: introduces a new for-loop that will iterate i through the values 0 through s-1.

Line 30: this is a condition in the ‘for’ function, after assigning an element to ‘max’, it will compare the
elements in the array, if any element is greater than ‘max’, it will become ‘max’.

Line 31: after finding the smallest element in the array by the ‘if’ statement, that element will be assigned
to max.

Line 32: close the body of the ‘if’ statement

Line 33: print the string inside quotations.

Line 34: this closes the int findMax function.

Line 35: declare int function that return a value named findMin to find the smallest value.

Line 36: assign 1 value in array named list[0].grade to ‘min’.

Line 37: introduces a new for-loop that will iterate i through the values 0 through s-1.

Line 38: this is a condition in the ‘for’ function, after assigning an element to ‘min’, it will compare the
elements in the array, if any element is less than ‘min’, it will become ‘min’.

Line 39: after finding the smallest element in the array by the ‘if’ statement, that element will be assigned
to min.

Line 40: close the body of the ‘if’ statement.

Line 41: print the string inside quotations.

Line 42: this closes the int findMin function.

Line 43: declare the main() function that return integer.

Line 44: opens the body of main().

Line 45: call the variables declared in the struct ‘student’.

Line 46: declare integer variables named n, choice, id.

Line 47: declare a float variable named grade


Line 48: print the string inside quotations.

Line 49: read input data that is integer.

Line 50: call the data in the void accept function.

Line 51: start do-while loop.

Line 52: print the string inside quotations.

Line 53: print the string inside quotations.

Line 54: print the string inside quotations.

Line 55: print the string inside quotations.

Line 56: print the string inside quotations.

Line 57: read input data that is integer.

Line 58: start switch statement of choice expression.

Line 59: opens the body of switch(choice).

Line 60: first case of the first statement.

Line 61: the first statement which calls the data in void display function.

Line 62: end and exit the loop.

Line 63: second case of the second statement.

Line 64: print the string inside quotations.

Line 65: the second statement which calls the data in ‘int findMax’ function.

Line 66: print the string inside quotations.

Line 67: the third statement which calls the data in ‘int findMin’ function.

Line 68: print the string inside quotations.

Line 69: end and exit the loop.

Line 70: close the switch statement.

Line 71: close the statements of do.

Line 72: the condition in do-while loop.


Line 73: terminate the function main() therefore exiting the whole program.

Line 74: close the main function.

II. Program results


III. Testing
1. Test plan

Test Case ID What’s How Data Expected Actual result Evaluate


being test result
1 Input Try to put Letter, Invalid Invalid Pass
number of letter, character choice choice
student character, Integer Data Data Pass
number. number accepted accepted
Decimal data Invalid In valid Pass
choice choice
2 Input Try to put Decimal data Invalid Invalid Pass
student’s ID float choice choice
variable, int Integer Data Data Pass
variable, number accepted accepted
char Letter, Invalid Invalid Pass
variable. characters choice choice

3 Input Try to put More than 2 Data Invalid Fail


student’s full name, word accepted choice
name first or last 1 word only Data Data Pass
name only, accepted accepted
number.

Integer Invalid Data


number choice accepted Fail
4 Input Try to put Letter, Invalid Invalid Pass
student’s letter, character choice choice
grade character, Integer Data Data Pass
integer number accepted accepted
number and Real number Data Data Pass
decimal. accepted accepted
5 User input Try to put Letter, Invalid Invalid Pass
choices letter, character choice choice
character Integer Data Data Pass
and number number accepted accepted
Decimal data Invalid Invalid Pass
choice choice

2. Analyse test results

In case 3, I can only input one wordwhen entering the student's name and cannot enter the whole name; to
do so, I must add the student's first name, middle name, and last name in the accept function. Another
misunderstanding I have is that names cannot be numbered, but this is possible.
IV. Evaluation

I will talk about the advantages of the program first. In general, the software program has met the
objectives of the scenario and, of course, the needs of the user (teachers). I started by using procedural
programming to solve the issue, the design is straightforward to understand and put into practice, and it is
presented scientifically, the app also includes a variety of different function features that are suited to the
requirements of the user.

In addition to the advantages mentioned above, the system has several shortcomings that need to be fixed.
There are several functions that make it possible for the user to enter student information, but if one
attribute is entered incorrectly, the rest of the student's attributes will be ignored, or worse, the program
will fail and enter an endless loop.

For future improvements, I can add some conditions to the program when the user enters the wrong input
format, the program can notify the user if they entered the wrong format and let allow them to re-enter the
data.

Generally, I have created a complete program for this Assignment 2 based on the evaluation, analysis, and
planning from Assignment 1. The program has been written in its entirety using that information as well
as the preparation. After that, I tested the program and assessed its advantages, disadvantages, as well as
potential improvements. I believe that the program is quite helpful for users.

Powered by TCPDF (www.tcpdf.org)


Index of comments

2.1 Based on the actual presentation and the report, the student presents parts :

Write a program that implements the designed solution (Page 4-9) ;

Test the program with a proper test plan (Page 11) (basic) .

The student needs to evaluate more about the program, validation, analyse test, state lessons learnt, advantages,
disadvantages, difficulties and future improvements...

(P4, P5)

Powered by TCPDF (www.tcpdf.org)

You might also like