Download Procedural Grade Management System: Design and Analysis and more Assignments C programming 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 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Phan Minh Tri Student ID GCD Class PROG102 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 Grading grid P4 P5 M3 M4 D
Summative Feedback: Resubmission Feedback:
Grade: Assessor Signature: Date: Lecturer Signature:
Table of Contents
- I. PROBLEM DESCRIPTION........................................................................................................................................
- II. IMPLEMENTATION (P4, M3)
- Coding standard
- Library in the program
- Variables in the program
- Do – while loop to enter the number of students in the class
- Menu options....................................................................................................................................................
- Switch – case loop in the menu options
- 6.1. Case 1: Input information of students
- 6.2. Case 2: Display information of students
- 6.3. Case 3: Find the highest and lowest grade of students
- 6.4. Case 4: Exit the program and Default
- III. PROGRAM RESULTS (P4)
- IV. TESTING (P5, M4)
- Test plan..........................................................................................................................................................
- Test log
- V. EVALUATION (D2)
- Figure 1: Local variable using camelc-cased letters...................................................................................................... Table of Figures
- Figure 2: Constant name using uppercase letter
- Figure 3: Library of the program
- Figure 4: Variables of the program
- Figure 5: Loop to enter the number of students in the class
- Figure 6: Menu options.................................................................................................................................................
- Figure 7: Input information of students
- Figure 8: Display information of students
- Figure 9:Find the highest and lowest grade of students
- Figure 10: Exiting the program and Default................................................................................................................
- Figure 11: Introduction and enter number of students
- Figure 12: Menu options.............................................................................................................................................
- Figure 13: Enter student's information.......................................................................................................................
- Figure 14: Display information of students
- Figure 15: Find the highest and lowest grade of student
- Figure 16: Exit the program
- Figure 17: Test plan.....................................................................................................................................................
- Figure 18: Test log
- grade Figure 19: Difficulty when finding the student with the highest and lowest grade if many of whom have the same
- Indentation:
- A space is required after entering a comma between the arguments of both functions.
- Each nested block should be properly indented and spaced.
- Proper indentation should be at the beginning and end of each block in the program.
- Library in the program
- In this program, I use <stdio.h> library because it provides the core of the input function. This library contains the “printf” function to display the input data to the screen. Figure 3 : Library of the program
- Variables in the program
- In this part, I use local variables to declare variables used in the program:
- Integer: ID (ID of students), choice, n (Number of students), i, j.
- Float: grade (Grade of students) Figure 4 : Variables of the program
- Do – while loop to enter the number of students in the class Figure 5 : Loop to enter the number of students in the class
- The first line of the loop is used to display the teacher welcome of the student management program.
- The main purpose of this loop is to enter the number of students within the specified range so that the teacher does not enter more than the allowed number (1 - 30).
- If the teacher mistypes it, the program sends a message on the screen asking the teacher to re- enter the number of students (“Enter wrong! Please re-enter: “).
- Menu options
- This menu presents specific options that make it easier for teachers to interact with the program:
- Enter the student’s IDs and grades
- Print all information of current student
- Find the highest and lowest grades
- Exit
6.2. Case 2: Display information of students
- The program uses a ‘for’ loop to print student’s information to the screen in order. Figure 8 : Display information of students 6.3. Case 3: Find the highest and lowest grade of students
- In this case, this program helps teacher find the student has highest and lowest grade among the students entered in case 1 and print to the screen.
- Find the student has highest grade:
- Max = grade[0], maxID = ID[0]
- i from 0 to (n – 1) (n is the number of students in the class)
- If max < grade[i] (grade[i] is the grade of one of the students entered) Max = grade[i], maxID = ID[i] (ID[i] is the ID of one of the students entered)
- Print the result on the screen
- Find the student has lowest grade:
- Min = grade[0], minID = ID[0]
- i from 0 to (n – 1) (n is the number of students in the class)
- If min > grade[i] (grade[i] is the grade of one of the students entered) Min = grade[i], minID = ID[i] (ID[i] is the ID of one of the students entered)
- Print the result on the screen
Figure 9 :Find the highest and lowest grade of students 6.4. Case 4: Exit the program and Default
- After performing all of above options, the program will display the option so that the teacher can end the program and the session.
- If the teacher selects an option that is not in the menu, the program reports an error a prompt the teacher to re-enter by using “default”. Figure 10 : Exiting the program and Default
- Display information of students to the screen Figure 14 : Display information of students
- Find the highest and lowest grade of student Figure 15 : Find the highest and lowest grade of student
- Exit the program Figure 16 : Exit the program
IV. TESTING (P5, M4)
- Test plan Test case Task name Task description Start date End date 1 The number of students Enter various data types into the program depending on the needs of the command
2 The choice of menu options Enter data inside and outside the allowed range in the menu options
3 The student’s ID Enter various data types into the program depending on the needs of the command
4 The student’s grade Enter various data types into the program depending on the needs of the command
5 Print information of students Make sure the program is running exactly as it was programmed
6 Print the highest and lowest grade Make sure the program is running exactly as it was programmed
7 Exit the program Make sure the program is running exactly as it was programmed
Figure 17 : Test plan
enter student’s ID into the program Typical data (5, 6, 7, …) The program reported the error and asked the teacher to re- enter Pass Decimal data (1.1, 1.2, …) The program reported the error and asked the teacher to re- enter Fail 3 The student’s ID Character (a, b, c, …) The program reported the error and asked the teacher to re- enter Fail Typical data (1, 2, 3, …) The program allows teachers to enter the students grade into the program Pass
Decimal data (1.1, 1.2, …) The program reported the error and asked the teacher to re- enter Fail 4 The student’s grade Character (a, b, c, …) The program reported the error and asked the teacher to re- enter Fail Typical data (1, 2, 3, …) The program accepts and continues execution Pass Decimal data (1.1, 1.2, …) The program accepts and continues execution Pass 5 Print information of students None Display all information of students Pass 6 Print the highest and lowest grade None Display the highest and lowest grade of student Pass
- Difficulties
- My current ability is yet to come up with a solution to fix the infinite loop error if the input data is wrong.
- If there are multiple students with the same lowest or highest grade, the program will only print 1 student. Figure 19 : Difficulty when finding the student with the highest and lowest grade if many of whom have the same grade ❖ Conclusion: Although the program has many errors, it can still be seen as a complete student management program that basically meets the needs of teachers. In the future, I will try to improve my ability to fix existing bugs, optimize and complete this program. Powered by TCPDF (www.tcpdf.org)
Index of comments 2.1 P4: presented the code needed to implement the designed solution P5: tested the program with proper test plan and test log M3: proved that the program was written following coding standards and validated input data M4: analyzed test results for future maintenance Powered by TCPDF (www.tcpdf.org)