Question

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

>=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.

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

>=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.

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

I’ve done all the testing and fixed the code. You can see the output.

Code:

#include <iostream>

#include <iomanip>

using namespace std;

struct StudentRecord{

double q1, q2;

double midterm, final;

double avg;

char grade;

};

//should prompt for input for one student and set the structure variable members.

void input(StudentRecord * student);

//use this to calculate the numeric average and letter grade.

void computeGrade(StudentRecord * student);

//outputs the student record.

void output(const StudentRecord student);

int main()

{

StudentRecord student;

input(&student);

computeGrade(&student);

output(student);

return 0;

}

void input(StudentRecord * student)

{

cout << "Please Enter marks for Quiz 1: ";

cin >> student->q1;

while(student->q1 < 0 || student->q1 > 10)

     { cout << "Must be between 0 and 10. Enter again: ";

        cin >> student->q1;

     }

cout << "Please Enter marks for Quiz 2: ";

cin >> student->q2;

while(student->q2 < 0 || student->q2 > 10)

     { cout << "Must be between 0 and 10. Enter again: ";

        cin >> student->q2;

     }

cout << "Please Enter marks for midterm: ";

cin >> student->midterm;

while(student->midterm < 0 || student->midterm > 100)

     { cout << "Must be between 0 and 100. Enter again: ";

        cin >> student->midterm;

     }

cout << "Please Enter marks for finals: ";

cin >> student->final;

while(student->final < 0 || student->final > 100)

     { cout << "Must be between 0 and 100. Enter again: ";

        cin >> student->final;

     }

}

void computeGrade(StudentRecord * student)

{

double p1 = (((student->q1 + student->q2) / 2) * 10) * 0.25;

double p2 = student->midterm * 0.25;

double p3 = student->final * 0.5;

student->avg = p1 + p2 + p3;

if (student->avg >= 90.0)

    student->grade = 'A';

else if (student->avg >= 80.0)

    student->grade = 'B';

else if (student->avg >= 70.0)

    student->grade = 'C';

else if (student->avg >= 60.0)

    student->grade = 'D';

else

    student->grade = 'F';

}

void output(const StudentRecord student)

{

cout << endl;

cout << setw(25) << left << "Quiz 1: " << student.q1 << endl;

cout << setw(25) << left << "Quiz 2: " << student.q2 << endl;

cout << setw(25) << left << "Midterm: " << student.midterm << endl;

cout << setw(25) << left << "Finals: " << student.final << endl;

cout << setw(25) << left << "Average: " << student.avg << endl;

cout << setw(25) << left << "Grade: " << student.grade << endl;

}

Output:

Add a comment
Know the answer?
Add Answer to:
Write a grading program for the following grading policies:- a. There are two quizzes, each graded...
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
  • 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:-...

  • 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...

  • 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...

  • Many classes calculate a final grade by using a weighted scoring system. For example, “Assignments” might...

    Many classes calculate a final grade by using a weighted scoring system. For example, “Assignments” might be worth 40% of your final grade. To calculate the grade for the Assignments category, the teacher takes the percentage earned on the assignments and multiplies it by the weight. So if the student earned a 90% total on the Assignments, the teacher would take 90% x 40, which means the student earned a 36 percent on the Assignments section. The teacher then calculates...

  • Java Program: In this project, you will write a program called GradeCalculator that will calculate the...

    Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...

  • 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...

  • 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...

  • Language: C++ Write a program that will allow the instructor to enter the student's names, student...

    Language: C++ Write a program that will allow the instructor to enter the student's names, student ID, and their scores on the various exams and projects. A class has a number of students during a semester. Those students take 4 quizzes, one midterm, and one final project. All quizzes weights add up to 40% of the overall grade. The midterm exam is 25% while the final project 35%. The program will issue a report. The report will show individual grades...

  • 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...

  • Write a Java program that reads a file until the end of the file is encountered....

    Write a Java program that reads a file until the end of the file is encountered. The file consists of an unknown number of students' last names and their corresponding test scores. The scores should be integer values and be within the range of 0 to 100. The first line of the file is the number of tests taken by each student. You may assume the data on the file is valid. The program should display the student's name, average...

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