Question: PROGRAM in C Rule 1: If the difference between the grade and the next multiple of 5 is less than 3, round the grade up

PROGRAM in C

Rule 1: If the difference between the grade and the next multiple of 5 is less than 3, round the grade up to the next multiple of 5. Ex. 81 is 4 points from 85 (the next multiple of 5) therefore the grade is not rounded. However, 88 is 2 points from 90, therefore, the grade will be rounded to 90.

Rule 2: If the grade is less than 38 do not round (do nothing).

You will be given a set of grades that will be read from a file. Round the grades that should be rounded. An example of an input file and the expected output is as follows:

Example input:

5 94 86 37 44 90

5 represents the number of grades to be read

The output for this input file would be the following:

2 = 0.40% of the students benefited from the grading policy change. The new grades are: 95 86 37 45 90 The following is a graph that represents the grade distribution for each grade category. A: * * *

B: C: D: * F: *

The functions provided are described below:

int* readData(FILE*, int*);

Read the number of grades, allocated the memory, and read the data storing it in the allocated memory.

void determineGrade(int*, int);

For each grade in the array, determine if the grade should be rounded or not. If it should be rounded then change it in the array. This is the function that I printed the statement saying how many students benefited from the new grading policy.

void printGrade(int, int*);

Prints the grades.

void CheckArguments( int argc);

Ensures the correct number of command line arguments are given. If not print: To few command line arguments. Exiting program. Then exit.

void checkFile(FILE*);

Check that the file pointer is not NULL. If it is NULL, print the following message: The file did not open successfully. Exiting program. Then exit.

void calculatePercent(int, int *);

Here you will need to determine how many As, Bs, Cs,Ds and Fs there are in the new grades. It is here that I called printGraph for each grade category.

void printGraph(int p);

This function prints the *s in the graph

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!