PROG102 Assignment 2 Frontsheet DUNVGCH - 1
PROG102 Assignment 2 Frontsheet DUNVGCH - 1
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:
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.
• 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
2. Test
IV. Evaluate