Student Grade Management Program, Assignments of Information Technology

A c program that allows users to enter student ids and grades, and then provides various functionalities such as displaying all student information, finding the student with the highest and lowest grades, and rating students as fail, pass, or merit based on their grades. The program utilizes arrays to store the student ids and grades, and implements several functions to handle the different operations. Detailed explanations of the program's structure, including the use of loops, conditional statements, and function calls. It also provides test cases to demonstrate the program's functionality under ideal conditions.

Typology: Assignments

2021/2022

Uploaded on 07/10/2022

mai-le-thanh-hoang-fgw
mai-le-thanh-hoang-fgw 🇻🇳

5 documents

1 / 20

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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
Mai Le Thanh Hoang
Student ID
GCD191206
Class
GCD1101
Assessor name
Pham Thanh Son
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
Hoang
Grading grid
P5
M4
[1]
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download Student Grade Management Program and more Assignments Information Technology 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 Mai Le Thanh Hoang Student ID GCD19 1206 Class GCD 1101 Assessor name Pham Thanh Son 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 Hoang Grading grid P4 P5 M3 M4 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

#include <stdio.h> int main() { int MAX = 50 ; // Maximum quantity int studentID[MAX]; float grades[MAX]; int a, n , u = 0 , p = 0 ; // a is the select of user in MENU float max, min; printf("Enter number of student:"); do { scanf("%d", &n); if(n == 0 || n > MAX) { printf("\nRe-enter the number of students: "); } } while(n == 0 || n > MAX); printf("\nEnter ID of student:\n"); for (int i = 0 ; i < n; i++) { printf("Student ID %d: ", i + 1 ); scanf("%d", &studentID[i]); } printf("\nEnter grades of student:\n"); I. Write a program that implements the designed solution (P4): In Assignment 1, I created the algorithm and flowchart for a software that enters student codes and grades into a class. Then determine which student has the highest and lowest score. The program will be built and presented in further depth in this Assignment 2 by creating and implementing software in the C programming language. Code for the program requested by teacher:

for (int i = 0 ; i < n; i++) { printf("Grades of student %d: ", studentID[i] ); scanf(" %f", &grades[i]); } char c = 'y'; while (c == 'y'|| c == 'Y') { printf("\n===================FUNCTION=====================\n"); printf("\n== 1. Show all student IDs and grades =="); printf("\n== 2. Find Student IDs has highest grades =="); printf("\n== 3. Find Student IDs has lowest grades =="); printf("\n== 4. Rating all student =="); printf("\n== 5. Exit! =="); printf("\n Select an activity you want: "); printf("\n================================================\n"); scanf("%d", &a); if (a == 1 ) for (int i = 0 ; i < n; i++) // use for loops to print all ID and grades of student { printf("\nStudent with ID %d: %.2f Point", studentID[i], grades[i]); } if (a == 2 ) { max = grades[ 0 ]; for (int i = 1 ; i < n; i++) { if ( grades[i] > max) { max = grades[i]; u = i; } } printf("\nStudent ID %d gets %.2f, Student has highest grades!", studentID[u], max);

1. Declare variables: Figure 1: Declare variables Float max, min: variable to find the highest and lowest score using float data type. Initialize the student ID and grades variable with an array equal to the Max value as declared before so that the program can import and save information about the student's ID and grades. 2. Do – While loop: Figure 2: Do - While loop (used to count the number of students) 3. For loops: } return 0 ; }

Figure 3: For loops (used to enter the number of IDs equal to the number of n students initially entered) For example, initially enter n students as 10 (n is the number of students), then when entering ID the program will run from the first value to the last value with a for loop Figure 4: For loop (used to enter the number of Grades equal to the number of n students initially entered) Similar to the above, initially enter n students as 10 (n is the number of students), then when entering the grade, the program will run from the first value to the last value by a for loop

4. Menu Functions: Figure 5: Menu Functions

8. Function to show information of student and evaluate students: Figure 9: Function 4 (Display information of student and evaluate students) The above code allows the program to give a student's rating based on the score when the user enters it with 3 types of evaluation: Merit if grades >= 8 and Student Pass if grades > 5 , and if grades <= 5 then the student will be assessed as Fail. 9. Program exit function: Figure 10: Function 5 (Exit program) If Y is selected and the program continues, select function 5 to exit the program. If you want to end the day program immediately without using function 5, then when the system asks "Do you want to continue or stop the program", we choose N to end the program. **II. Test the program with proper test plan (P5):

  1. Test and print the results under ideal conditions.:** a. Enter values Student IDs and Grades:

In this program, MAX is the number of students in a class. If the class has 50 students then the value of MAX = 50 and the teacher can enter student IDs and grades of 30 students in one run of the program. In this case I only entered 5 out of 50 students in a class. Figure 11: Enter number of student Enter the number of students you want to enter: 5 students. Figure 12: Enter five Student IDs and Grades Enter the IDs and grades of 5 students: IDs:

  • Student ID 1: 123
  • Student ID 2: 456
  • Student ID 3: 789
  • Student ID 4: 159
  • Student ID 5: 753

Figure 15: Result of Function 1 After executing function 1, enter Y to continue other functions and enter N to end the program. Figure 16: Enter Y and choose function 2 After entering Y, the program will display Menu Functions again and I choose function 2 (function to find the student with the highest grade)

Figure 17: Result of function 2 (Finding the student has highest grade) After selecting function number 2, the system will display the student with the highest score (displayed information includes Student ID and score achieved) Figure 18: Result of function 3 (Finding the student has lowest grade) Enter Y, the program displays Menu Function again and select function number 3 (function to find the student with the lowest score).

Figure 20: Result of function 5 (End the program) To exit the program, we can enter N after completing function 4 or enter Y to continue executing function 5 (function to exit the program).

2. Test case: Test data Expected Result Actual Result Pass/Fail 1 - Enter number of - Enter number of student: 2 student: 2

  • Enter ID of - Enter ID of student: student:
  • Student ID 1: •Student ID 1: GCD15943 GCD
  • Student ID 2: •Student ID 2: Fail GCD75143 GCD
  • Enter grades of - Enter grades of student: student:
  • Grade of student •Grade of student GCD15943: 8 GCD15943: 8
  • Grade of student •Grade of student GCD75143: 2 GCD75143: 2

2 - Enter number of student: 3

  • Enter ID of student: •Student ID 1: 123 •Student ID 2: 456 •Student ID 3: 789
  • Enter grades of student: •Grade of student 123: 5 •Grade of student 456: 8 •Grade of student 789: 8 Select an activity you want: 2
    • Enter number of student: 3
    • Enter ID of student: •Student ID 1: 123 •Student ID 2: 456 •Student ID 3: 789
    • Enter grades of student: •Grade of student 123: 5 •Grade of student 456: 8 •Grade of student 789: 8 Select an activity you want: 2 →Student ID 456 gets 8.00 and Student ID 789 gets 8.00, Student has highest grades! Fail

4 - Enter number of student: 3

  • Enter ID of student: •Student ID 1: 123 •Student ID 2: 456 •Student ID 3: 789
  • Enter grades of student: •Grade of student 123: 8 •Grade of student 456: 6 •Grade of student 789: 2 Select an activity you want: 4
    • Enter number of student: 3
    • Enter ID of student: •Student ID 1: 123 •Student ID 2: 456 •Student ID 3: 789
    • Enter grades of student: •Grade of student 123: 8 •Grade of student 456: 6 •Grade of student 789: 2 Select an activity you want: 4 →Student ID 123: 8.00 point Student ID 123: Merit Student ID 456: 6.00 point Students ID 456:Pass Student ID 789: 2.00 point Students ID 789:Fail Pass

5 - Enter number of student: 2

  • Enter ID of student: •Student ID 1:

•Student ID 2:

  • Enter grades of student: •Grade of student 1.14: 8 •Grade of student 2.14: 5 Select your activity: 2
    • Enter number of student: 2
    • Enter ID of student: •Student ID 1:
    •Student ID 2:
    • Enter grades of student: •Grade of student 1.14: 8 •Grade of student 2.14: 5 Select your activity: 2 →Student ID 1. gets 8.00, Student has highest grades! Fail