Question

In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each gr...

In C Langage

Write a grading program for a class with the following grading policies:-

a. There are two quizzes, each graded on the basis of 10 points.

b. There is one midterm exam and one final exam, each graded on the basis of 100

points.

c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent

and the two quizzes together count for a total of 25 percent.

Grading system is as follows:-

>90 A

>=80 and <90 B

>=70 and <80 C

>=60 and <70 D

<60 E

The program should read in the student's scores and output the student's record, which

consists of two quiz and two exam scores as well as the student's average numeric

score for the entire course and the final letter grade. Define and use a

structure

for the

student record.

Utilize these function prototypes:-

void input(StudentRecord * student);

//should prompt for input for one student and

set the structure variable members.

void computeGrade(StudentRecord * student);

//use this to calculate the numeric

average and letter grade.

void output(const StudentRecord student);

//outputs the student record.

Sample Output

:-

Sample data for the test run:-

1 7 10 90 95

2 9 8 90 80

3 7 8 70 80

4 5 8 50 70

5 4 0 40 35

Output:

enter the student number:

1

enter two 10 point quizes

7 10

enter the midterm and final exam grades. These are 100 point tests

90 95

enter the student number:

2

enter two 10 point quizes

9 8

enter the midterm and final exam grades. These are 100 point tests

90 80

enter the student number:

3

enter two 10 point quizes

7 8

enter the midterm and final exam grades. These are 100 point tests

70 80

enter the student number:

4

enter two 10 point quizes

5 8

enter the midterm and final exam grades. These are 100 point tests

50 70

enter the student number:

5

enter two 10 point quizes

4 0

enter the midterm and final exam grades. These are 100 point tests

40 35

The record for student number: 1

The quiz grades are: 7 10

The midterm and exam grades are: 90 95

The numeric average is: 91.25

and the letter grade assigned is A

The record for student number: 2

The quiz grades are: 9 8

The midterm and exam grades are: 90 80

The numeric average is: 83.75

and the letter grade assigned is B

The record for student number: 3

The quiz grades are: 7 8

The midterm and exam grades are: 70 80

The numeric average is: 76.25

and the letter grade assigned is C

The record for student number: 4

The quiz grades are: 5 8

The midterm and exam grades are: 50 70

The numeric average is: 63.75

and the letter grade assigned is D

The record for student number: 5

The quiz grades are: 4 0

The midterm and exam grades are: 40 35

The numeric average is: 32.5

and the letter grade assigned is F

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find below the complete code as per the requirements. It is well explained inside the code using comments.

#include <stdio.h>

// StudentRecord Structure
struct StudentRecord
{
   int studentNo;           // student no.
   int quiz1Score;           // score of quiz 1
   int quiz2Score;           // score of quiz 2
   int midtermScore;       // score of exam 1
   int finalExamScore;       // score of exam 2
   float avgNumericScore;   // average numeric score
   char letterGrade;       // letter grade
};

// prompt for input for one student and set the structure variable members.
void input(struct StudentRecord *student);

// calculates the numeric average and letter grade.
void computeGrade(struct StudentRecord *student);

// outputs the student record.
void output(const struct StudentRecord student);

// main function
int main()
{
   int i;

   // array of StudentRecord
   struct StudentRecord record[5];

   // read student information
   for (i = 0; i < 5; i++)
   {
       input(&record[i]);
   }

   // compute grades
   for (i = 0; i < 5; i++)
   {
       computeGrade(&record[i]);
   }

   // print the output
   for (i = 0; i < 5; i++)
   {
       output(record[i]);
   }

   return 0;
}

// prompt for input for one student and set the structure variable members.
void input(struct StudentRecord *student)
{
   // read and input student record
   printf("Enter the student number:\n");
   scanf("%d", &student->studentNo);
   printf("Enter two 10 point quizes:\n");
   scanf("%d %d", &student->quiz1Score , &student->quiz2Score);
   printf("Enter the midterm and final exam grades. These are 100 point tests:\n");
   scanf("%d %d", &student->midtermScore, &student->finalExamScore);
}

// calculates the numeric average and letter grade.
void computeGrade(struct StudentRecord *student)
{
   int sumQuizzes;           // sum of quizzes
   sumQuizzes = student->quiz1Score + student->quiz2Score;

   // calculate average numeric score
   student->avgNumericScore = ((float)sumQuizzes * 25 / 20) + ((float)(student->midtermScore) * 25 / 100) + ((float)(student->finalExamScore) * 50 / 100);

   // find numeric grade
   if (student->avgNumericScore > 90)
       student->letterGrade = 'A';
   else if (student->avgNumericScore >= 80)
       student->letterGrade = 'B';
   else if (student->avgNumericScore >= 70)
       student->letterGrade = 'C';
   else if (student->avgNumericScore >= 60)
       student->letterGrade = 'D';
   else
       student->letterGrade = 'E';
}

// outputs the student record.
void output(const struct StudentRecord student)
{
   printf("The record for student number: %d\n", student.studentNo);
   printf("The quiz grades are: %d %d\n", student.quiz1Score, student.quiz2Score);
   printf("The midterm and exam grades are: %d %d\n", student.midtermScore, student.finalExamScore);
   printf("The numeric average is: %.2f\n", student.avgNumericScore);
   printf("and the letter grade assigned is %c\n", student.letterGrade);
}

Below is the sample output:

Enter the student number: Enter two 10 point quizes: 7 10 Enter the midterm and final exam grades. These are 100 point tests:

This completes the requirement. Let me know if you have any queries.

Thanks!

Add a comment
Know the answer?
Add Answer to:
In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each gr...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a grading program for the following grading policies:- a. There are two quizzes, each graded...

    Write a grading program for the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:- >90 A >=80 and <90 B...

  • using if/switch statements (C++) Write a grading program for a class with the following grading policies:...

    using if/switch statements (C++) Write a grading program for a class with the following grading policies: There are two quizzes, each graded on the basis of 10 points There is one midterm exam and one final exam, each graded on the basis of 100 points The final exam counts for 50% of the grade, the midterm counts for 25% and the two quizzes together count for a total of 25%. (Do not forget to normalize the quiz scores. They should...

  • Write a program to calculate your final grade in this class. Three(8) assignments have yet to...

    Write a program to calculate your final grade in this class. Three(8) assignments have yet to be graded: Quiz 7, Lab 7 and Final Project. Assume ungraded items receive a grade of 100 points. Remember to drop the lowest two quiz scores. Display final numeric score and letter grade. Implementation: Weight distribution is listed in canvas. Use arrays for quizzes, labs, projects and exams. You are allowed to use initialization lists for arrays. Use at least three (3) programmer defined...

  • C++ Write a program to calculate final grade in this class, for the scores given below...

    C++ Write a program to calculate final grade in this class, for the scores given below . Remember to exclude one lowest quiz score out of the 4 while initializing the array. Display final numeric score and letter grade. Use standard include <iostream> Implementation: Use arrays for quizzes, labs, projects and exams. Follow Sample Output for formatting. May use initialization lists for arrays. Weight distribution is as follows: Labs: 15% Projects: 20% Quizzes: 20% Exams: 25% Final Project: 20% Display...

  • c++ implement a student class Determine the final scores, letter grades, and rankings of all students...

    c++ implement a student class Determine the final scores, letter grades, and rankings of all students in a course. All records of the course will be stored in an input file, and a record of each student will include the first name, id, five quiz scores, two exam scores, and one final exam score. For this project, you will develop a program named cpp to determine the final scores, letter grades, and rankings of all students in a course. All...

  • C++ Language A continuation of your grading software will be made you do not need your...

    C++ Language A continuation of your grading software will be made you do not need your other code for this assignment). In this one you will intake a students first name and last name from a file called "students.txt". Next, there is a file called grades.txt that contains the grades in a course. There will be three grades for each student in "grades.txt" (see example file bellow). In "student.txt" there are two students first and last names. In "grades.txt" the...

  • C++ Write a program that reads the number of students in the class, then reads each...

    C++ Write a program that reads the number of students in the class, then reads each student's name and his/her test score. Print out each student name, test score and grade, and the average score of the whole class. The program must use vectors and loops for the implementation. The grades are determined as follows: A >= 90; 80 <= B < 90; 70 <= C < 80; 60 <= D < 70; F < 60.

  • Write a program called printGPA. The program should contain at least 3 methods: main, gradeAverage, and...

    Write a program called printGPA. The program should contain at least 3 methods: main, gradeAverage, and letterGrade. The user will type a line of input containing the student's name, then a number that represents the number of scores, followed by that many integer scores (user input is in bold below). The data type used for the input should be one of the primitive integer data types. Here are two example dialogues: Enter a student record: Maria 5 72 91 84...

  • Grading Policy In addition to three in-class tests and a final exam, the final grade will...

    Grading Policy In addition to three in-class tests and a final exam, the final grade will include assessment of homework, quiz projects/classroom activities, and classroom participation, according to the following weights 1. Homework and Worksheets 2. Three Tests 3. Final Exam 4. Quizzes and Class Participation/Classroom Citizenshi 1 5% 40% 25% 20% Total 100% Grad Ran 92 100 90-91 88-89 82-87 80-81 an 78 -79 70-77 68 -69 66 67 60- 65 Assignment Grading: Each written assignment, except the Final...

  • A continuation of your grading software will be made (you do not need your other code...

    A continuation of your grading software will be made (you do not need your other code for this assignment). In this one you will intake a students first name and last name from a file called "students.txt". Next, there is a file called grades.txt that contains the grades in a course. There will be three grades for each student in "grades.txt" (see example file bellow). In "student.txt" there are two students first and last names. In "grades.txt" the grades for...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT