Managing Student Grades in C Programming: A Detailed Analysis, Assignments of Information Technology

pass pass pass pass pass pass pass pass pass pass pass pass

Typology: Assignments

2020/2021

Uploaded on 08/27/2021

imissyou
imissyou 🇻🇳

4.6

(33)

9 documents

1 / 19

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 1 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
Dinh Xuan Truong
Student ID
GCH200308
Class
GCH0908
Assessor name
Nguyen Tran Dinh Long
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
Truong
Grading grid
P1
P2
P3
M1
M2
D1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Managing Student Grades in C Programming: A Detailed Analysis and more Assignments Information Technology in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Prog 102 : Procedural Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Dinh Xuan Truong Student ID GCH Class GCH0908 Assessor name Nguyen Tran Dinh Long 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 Truong Grading grid P1 P2 P3 M1 M2 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

I. Implementation

i. 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 this 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. In assignment 1, I wrote a small program about managing student grades. And now I make this report for the purpose of detailed analysis of my program with pictures, tables, footnotes, and specific explanations.

ii. Explain my code.

According to the curriculum, I used C++ language.

1. Libraries

There are the libraries I used:

The #include tells the compiler that we need to use the declared library and it will

automatically add it for us.

Library Definition Example for functions

<stdio.h> The header file named

stdio.h in the Standard C

Library defines three types

of variables, a number of

macros, and various

functions to perform input

and output.

Printf, scanf, gets, puts,

getchar, putchar,…

<ctype.h> The ctype.h header file of

the C Standard Library

declares several functions

that are useful for testing

and mapping characters.

Isdigit, isalpha, toupper,

isalnum,…

<stdbool.h> The purpose in C of this

header is to add a bool type

and the true and false

values as macro definitions.

True, false.

<string.h> This header file defines

several functions to

manipulate C strings and

arrays.

Strcpy, strcmp, strlen,…

  1. Initialize and declare

There are all of data types I used for my program.

notification will warning you to input info

first.

After initialize and declare, I started create 5 functions with void functions:

a. Input information

I used for-loop structure to get the list of students in order.

In here, I used ‘i+1’ because ‘student’ never be student number ‘0’. It always starts from first student. Print to screen “Enter name: “to let user enter information of students. May can use scanf(%[^/n]s) but I use gets because it’s brevity.

To errors that show up like this, using fflush(stdin) to clear cache. The problem will be sloved. I use while-loop structure in here, if grade less than 0 and more than 10, it will force the user to re-

enter, because point ladder always starts from 0 → 10. So, if user enter right grade, it will move to

enter IDs. print “ID: “to screen to let user enter information.

b. Show information

Then, after we got the highest score, we also need to find ID of student have highest score. After ‘max’ have new value proportional with grade[i], so it also proportional with id[i] from array[i]. Example grade[2] proportional to id[2]. Print highest score and Id student in if structure.

d. Find students with lowest score

Similar to find highest score. I used for-loop structure to get grade that had input in “Input information”. Create an integral type of variable that is initialized to the highest possible value. We will call this value "min". Fill the array with the data that you need. Iterate through the array. For each element, compare it to "min". If "max" is raiser than the element of the array, assign temp that specific element of the array.

Then, after we got the lowest score, we also need to find ID of student have lowest score. After ‘min’ have new value proportional with grade[i], so it also proportional with id[i] from array[i]. Print highest score and Id student in if structure.

e. Calculate the average score

I set float average to calculate the average score, also same structure with grade. Using for-loop structure to calculate average. After user enter grades of students, total of student will be added together and stored in average variable. Casting integer n to real number. Formula for average score is sum of grades divide by total of students. After created 5 void functions, next, I used it for main functions:

I used printf("\n**********************\n\n"); to display clearly.

Firstly, I used while-loop structure to check total of student. If user enter less then 3 students or more than real total students of teacher’s class (in topic), user must enter again. After user enter right, it will save in variable n. I warned user that need to use case 1 first because if case 1 has information, then another case can be used. There is menu manage student’s grade. After enter user choice, choice variable will be used for switch- case structure to make menu can be work.

I used while-loop structure for switch-case structure because user has 6 choices. Choice 6

is Exit program will be use until user want to exit program, so I set.

Case 1 is mandatory, run Inputinfo() function, after that, assign check=true and return to the menu.

If user choose case 2, it will run Showinfo () function, it happens if user input case 1 first. Or not, it will print to screen “You must input information first.” To make it work, I used if-else structure to control it. Finish case 2 , return to the menu.

In another case, I also used if-else structure to check did user enter case 1 first or not.

When user choose case 3, system will calculate and find ID student with highest score by Highest () function. Then, return to the menu. Case 4 will be used to show ID student with lowest score by Lowest () function. Case 5 will calculate and show average of grade’s students by average () function.

this problem happens when user did not input information first c) Show information d) Find student have highest score e) Find student have lowest score f) Calculate average of grade’s student

g) Exit program

Program evaluation:

o Pros:

Satisfy enough teacher's request. I added new one function is average

function.

When finished an option, it will return to the menu to let user can choose

different option.

Look neater and easier to use because I use “************”.

o Cons:

My program doesn’t save information in a .txt file.

Function name, ID is not really optimization, there are not many conditions

such as : name always less than 30 characters or ID must only 8 numbers.

If teacher wants to edit student information. He/ she must re-enter.

There are something recommend to improve my program in the future:

_ Can save information in .txt or .doc file.

_ Add more function such as: gender, address. It can help teacher easier contact.

_ More optimization.

III. Testing

Test case What’s being test How Data Expected result Actual result Evaluate 1 Input total of students Try to input boundary data, typical data, and bad data Letters; characters (a, b, @, $,...) Invalid choice Error program Fail Typical data Data accepted Data accepted Pass Decimal data Invalid choice Invalid choice Pass Boundary data Invalid choice Invalid choice Pass 2 Input IDs Try to input boundary Letters; characters (a, b, @, $,...) Invalid choice Error program Fail

To me, after I created a program that manage grade’s student, I understood how to write a small program useful, despite it’s not enough function, structure and code is not really clearly. But in future, I will learn more soft skills and more experience to improve and update my coding skills.