C++ assignments
myCodeMate Exercise 10.01/.DS_Store
__MACOSX/myCodeMate Exercise 10.01/._.DS_Store
myCodeMate Exercise 10.01/mycodemate10a1.cpp
myCodeMate Exercise 10.01/mycodemate10a1.cpp
// ******************************************************************
//
// Grades.cpp
//
// This program computes student grades. For each student, two
// quiz grades (graded on a 10 point basis), one midterm exam grade
// and one final exam grade (each on a 100 point basis) are read
// in. The final numeric grade is computed weighing the final
// exam 50%, the midterm 25%, and the quizzes 25%. The numeric
// grade and corresponding letter grade are output.
//
// ******************************************************************
#include
<
iostream
>
using
namespace
std
;
//
// Structure for a student record
//
// --------------------------------
// ----- ENTER YOUR CODE HERE -----
// --------------------------------
// --------------------------------
// --------- END USER CODE --------
// --------------------------------
void
outputRecord
(
StudentRecord
record
)
{
cout
<<
endl
;
cout
<<
"Quiz Scores: "
<<
record
.
quiz1
<<
" "
<<
record
.
quiz2
<<
endl
;
cout
<<
"Midterm Exam Score: "
<<
record
.
midtermExam
<<
endl
;
cout
<<
"Final Exam Score: "
<<
record
.
finalExam
<<
endl
;
cout
<<
endl
;
cout
<<
"Course Average: "
<<
record
.
courseAverage
<<
endl
;
cout
<<
"Final Letter Grade: "
<<
record
.
letterGrade
<<
endl
;
cout
<<
endl
;
}
void
computeAverage
(
StudentRecord
&
record
)
{
const
double
EXAM_WT
=
0.5
;
const
double
MIDTERM_WT
=
0.25
;
const
double
QUIZ_WT
=
0.25
;
double
quiz1Percent
,
quiz2Percent
;
//
// Convert the 10 point quizzes to a percent, then find the average
//
quiz1Percent
=
100
*
record
.
quiz1
/
10.0
;
quiz2Percent
=
100
*
record
.
quiz2
/
10.0
;
double
quizAvg
=
(
quiz1Percent
+
quiz2Percent
)
/
2
;
//
// Compute the weighted average to get the numeric course grade
//
record
.
courseAverage
=
quizAvg
*
QUIZ_WT
+
record
.
midtermExam
*
MIDTERM_WT
+
record
.
finalExam
*
EXAM_WT
;
//
// Call the letterGrade function to find the corresponding letter grade
record
.
letterGrade
=
letterGrade
(
record
.
courseAverage
);
}
char
letterGrade
(
double
numericGrade
)
{
char
letter
;
if
(
numericGrade
<
60
)
letter
=
'F'
;
else
if
(
numericGrade
<
70
)
letter
=
'D'
;
else
if
(
numericGrade
<
80
)
letter
=
'C'
;
else
if
(
numericGrade
<
90
)
letter
=
'B'
;
else
letter
=
'A'
;
return
letter
;
}
__MACOSX/myCodeMate Exercise 10.01/._mycodemate10a1.cpp
myCodeMate Exercise 10.01/myCodeMateDirectionsEx10a1.txt
myCodeMate Exercise 10.1 Directions 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% 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 be converted to a percent before they are averaged in.) Any grade of 90 or more is an A, any grade of 80 or more (but less than 90) is a B, any grade of 70 or more (but less than 80) is a C, any grade of 60 or more (but less than 70) is a D, and any grade below 60 is an F. The program will 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. Input and output should be done via the keyboard and screen.