Download Assignment Brief 2 (RQF) and more Assignments Programming Methodologies in PDF only on Docsity!
ASSIGNMENT 2 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing Unit number and title PROG102: Procedural Programming Submission date 10 /09/ 2021 Date Received 1st submission Re-submission Date 18 /09/ 2021 Date Received 2nd submission Student Name Huynh Bao Trong Student ID GCC Class GCC0902 Assessor name Nguyen Hung Dung 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 P 4 P 5 M3 M4 D
Summative Feedback: Resubmission Feedback:
Grade: Assessor Signature: Date: Lecturer Signature:
Assignment Brief Scenario: Please refer to scenario in Assignment 1. Tasks 1 Your next task is to implement the software that you designed in previous steps. You need to implement the software designed in assignment 1 using C programming language. Your code must make use of programming standards, including file headers and effective code commenting. You need to provide screenshots of your program when running. During the development of your program, if you make any changes to the original design, state them with reasons in report. Your code listings must be included as an appendix. Task 2 Test your program by making a test plan, execute it and log results. Your test plan should include data validation and program operations based on requirements. Test results (passed or failed) should be analysed to help the program in future maintenance. Task 3 Write an evaluation and conclusion of the whole development. The evaluation of your program should be based on its running and its test result. You should mention about lessons learnt and future improvement. Also evaluate how procedural programming is applied in your program, state benefits, disadvantages or difficulties. A final report of these 3 tasks must be submitted in PDF format to CMS. Submission Format The submission is in the form of a Word document. You are required to make use of appropriate structure, including headings, paragraphs, subsections and illustrations as appropriate, and all work must be supported with research and referenced using the Harvard referencing system.
Table of Contents
- I. Write a program that implements the designed solution.............................................................................
- Design software for assignment 1 using a C programming language:
- Overview of functions and their functions in the C programming language:
- Change from the original designed:
- II. Test the program with proper test plan.
- III. Analyse test results for future maintence.
- IV. Evaluate your program, state lessons learnt and future inprovement.
- References
- Appendix
- Input student ID and check if the ID is duplicated or not. If it is duplicated, the user needs to input it again.
- Input student Grade and check if the grade is valid or not. If it is not valid, the user needs to input it again.
- Function output information of students: Help you print student information to the screen.
- Function find the maximum grade of student: Help you find the student who has maximum grades and print to the screen.
- max = Grade[0]
- If max < Grade[i] then max = Grade[i]
- Print the result on the screen.
- Function find the minimum grade student: Help you find the student who has minimum grades and print to the screen.
- min = Grade[0]
- If min > Grade[i] then min = Grade[i]
- Print the result on the screen. The screenshot:
- Function input information of students:
- Function find the minimum grade student:
- When Enter choice: 3
- Function exit menu:
- When Enter choice: 4 3. Change from the original designed:
- “switch…case” statement to “if…else”: The if else statement is a conditional statement that will run a set of statements depending on whether the condition is true or false. Switches can be used to test a single variable. The difference between if else and switch is that the if else block executes based on the evaluation of the expression in the if statement, while the switch statement selects the statements to execute depending on the single variable, passed to it. Shorter structure than "switch...case".
- Declare more variable c: So that when entering "Enter number of student" as a character, the program will report an error and force re-enter a larger number.
II. Test the program with proper test plan.
Test Plan:
- Creator: Huynh Bao Trong
- Create Date: 03/09/
No Test case Function Input Data
Expected
output
Actual output Result
- Verify that Student information will save into array if user enters valid information. InputStudent - Enter number of student: 2
- Enter student ID 1: 3
- Enter student Grade 1: 8
- Enter student ID 2: 5
- Enter student Grade 2: 9
- ID[] = {3,5}
- ID[] = {3,5}
- Verify that "Invalid student number, please enter again" when the user enters the negative number.
- Enter number of student: - 2 Display information: “Invalid number of students, please enter again “ Display information: “Invalid number of students, please enter again “ Pass
- Verify that "Invalid student number, please enter again" when the user
- Enter number of student: ‘a’ Display information: “Invalid number of students, please enter again “ Display information: “Invalid number of students, please enter again “ Pass
user selects "Maximum grade of student".
- Enter student ID 2: 5
- Enter student Grade 2: 9
- Enter choice: 2
- Verify that "Student Minimum Score" is displayed when the user selects "Minimum grade of student". FindMin - Enter number of student: 2
- Enter student ID 1: 3
- Enter student Grade 1: 8
- Enter student ID 2: 5
- Enter student Grade 2: 9
- Enter choice: 3 Minimum grade of student 8. 00 Minimum grade of student 8. 00 Pass
- Verify that “ Please input again” when the user enters the value larger than 10. InputStudent - Enter number of student:
- Enter student ID 1:
- Enter student Grade 1: Display information: “Please Input again” Display information: “Please Input again” Pass
- Verify that “ Please input again” when the user enters the value smaller than
- Enter number of student:
- Enter student ID 1:
- Enter student Grade 1:- 3 Display information: “Please Input again” Display information: “Please Input again” Pass
III. Analyse test results for future maintence.
IV. Evaluate your program, state lessons learnt and future inprovement.
Appendix
#include<stdio.h> #include<conio.h> //Function of variable int Variable(char c[]) { int i,a; for(i=0; i<strlen(c) ;i++) { if(c[i] >= '0' && c[i] <= '9') { a =1; } else { a =0; break ; } } if(a ==1) return 1; else return 0; } //Function Input information of students void InputStudent(int ID[], float Grade[], int n) { int i=0; int j; do { printf("Enter student ID %d:",i+1); scanf("%d",&ID[i]); for (j=0;j<i;j++) {while(ID[i]==ID[j]) { printf("Duplicate ID , please enter again\n"); printf("Enter student ID %d:",i+1); scanf("%d",&ID[i]); }
do { printf("Enter student Grade %d:",i+1); scanf("%f",&Grade[i]); if(Grade[i]<0 || Grade[i]>10) printf("Please Input again\n"); } while(Grade[i]<0 || Grade[i]>10); i++; }while (i<n); } //Function Output information of students void OutputStudent(int ID[], float Grade[], int n) { int i; printf("\nStudent Information:"); for (i=0; i<n;i++) { printf("\nStudent ID %d: %d",i+1, ID[i]); printf("\nStudent Grade %d: %.2f ",i+1, Grade[i]); } } //Function find the maximum grade of student float FindMax(float Grade[], int n) { float max; int i; max =Grade[0]; for (i=0;i<n;i++) if (max < Grade[i]) max = Grade[i]; return max; } //Function find the minimum grade student float FindMin(float Grade[], int n) {
if(choice ==1) { OutputStudent(ID, Grade, n); } else if(choice==2) { printf("\n Maximum grade of student %.2f",FindMax(Grade,n)); } else if (choice==3) { printf("\n Minimum grade of student %.2f",FindMin(Grade,n)); } else if(choice==4) { exit(1); } else { printf("Invalid choice"); } }while (choice != 4); }