Given a basic template to calculate a course average you mus

Given a basic template to calculate a course average you must revise the program to do the following.

1.Take in the students name

2.Make the program match the items and percentages listed on our class syllabus

3.Use a random number generator to determine a grade for each component of the syllabus (i.e Labs & Quizzes: 80%) & use a seed of 12

4.Output the final average as a number and letter grade

// Example program
#include <iostream>
#include <string>
#include <cstdlib>   
#include <ctime>

int main()
{
srand(time(0))
//// Variables
YourName
  
const double HOMEWORK_MAX = 100.0;
const double QUIZ_MAX = 100.0;
const double EXAM1_MAX = 100.0;
const double EXAM2_MAX = 100.0;
const double PROJECT_MAX = 100.0;
const double INCLASS_MAX = 100.0;
const double FINAL_MAX = 100.0;
const double HOMEWORK_WEIGHT = 0.15; // 15%
const double EXAM1_WEIGHT = 0.30;
const double EXAM2_WEIGHT = 0.30;
const double PROJECT_WEIGHT = 0.15;
const double INCLASS_WEIGHT = 0.15;
const double QUIZ_WEIGHT = 0.15;
const double FINAL_WEIGHT = 0.15;
  
double homeworkScore = 0.0;
double midtermScore = 0.0;   
double quizScore = 0.0;
double projectScore = 0.0;
double inclassScore = 0.0;
double finalScore = 0.0;
double coursePercentage = 0.0;

Solution

// https://ideone.com/BOQyzx

#include <iostream>
#include <string>   
#include <cstdlib>   
#include <ctime>
using namespace std;

char getGrade(double coursePercentage);

int main() {
srand(time(0));

const double HOMEWORK_MAX = 100.0;
const double QUIZ_MAX = 100.0;
const double EXAM1_MAX = 100.0;
const double EXAM2_MAX = 100.0;
const double PROJECT_MAX = 100.0;
const double INCLASS_MAX = 100.0;
const double FINAL_MAX = 100.0;
const double HOMEWORK_WEIGHT = 0.15; // 15%
const double EXAM1_WEIGHT = 0.30;
const double EXAM2_WEIGHT = 0.30;
const double PROJECT_WEIGHT = 0.15;
const double INCLASS_WEIGHT = 0.15;
const double QUIZ_WEIGHT = 0.15;
const double FINAL_WEIGHT = 0.15;

  
double homeworkScore = 0.0;
double midtermScore = 0.0;   
double quizScore = 0.0;
double projectScore = 0.0;
double inclassScore = 0.0;
double finalScore = 0.0;
double coursePercentage = 0.0;

const int RAND_SEED=12;

double exam1Score = 0.0;
double exam2Score = 0.0;
  
string studentname;
cout << \"Enter the student name:\" << endl;
cin >> studentname;

homeworkScore=(rand()%RAND_SEED)*(HOMEWORK_MAX/RAND_SEED);
exam1Score=(rand()%RAND_SEED)*(EXAM1_MAX/RAND_SEED);
exam2Score=(rand()%RAND_SEED)*(EXAM2_MAX/RAND_SEED);
finalScore=(rand()%RAND_SEED)*(FINAL_MAX/RAND_SEED);
inclassScore=(rand()%RAND_SEED)*(INCLASS_MAX/RAND_SEED);
projectScore=(rand()%RAND_SEED)*(PROJECT_MAX/RAND_SEED);
quizScore=(rand()%RAND_SEED)*(QUIZ_MAX/RAND_SEED);

cout << \"Student Name : \" <<studentname<< endl;
cout << \"home score: \" <<getGrade(homeworkScore)<< endl;
cout << \"quiz score: \" <<getGrade(quizScore)<< endl;
cout << \"exam 1 score: \" <<getGrade(exam1Score)<< endl;
cout << \"exam 2 score: \" <<getGrade(exam2Score)<< endl;
cout << \"project score: \" <<getGrade(projectScore)<< endl;
cout << \"final score: \" <<getGrade(finalScore)<< endl;
   cout << \"inclass score: \" <<getGrade(inclassScore)<< endl;

coursePercentage = ((homeworkScore / HOMEWORK_MAX) * HOMEWORK_WEIGHT)
+ ((finalScore / FINAL_MAX) * FINAL_WEIGHT)
+ ((quizScore / QUIZ_MAX) * QUIZ_WEIGHT)
+ ((exam1Score / EXAM1_MAX) * EXAM1_WEIGHT)
+ ((exam2Score / EXAM2_MAX) * EXAM2_WEIGHT)
+ ((inclassScore / INCLASS_MAX) * INCLASS_WEIGHT)
+ ((projectScore / PROJECT_MAX) * PROJECT_WEIGHT);
coursePercentage = coursePercentage * 100; // Convert fraction to %

cout << endl << \"Your course percentage is: \";
cout << coursePercentage << endl;


if (coursePercentage >= 90 && coursePercentage <= 100)
{
if (exam2Score >= 90 && projectScore >= 90)
{
    cout << \"You made an A and are excused from the final exam!\" << endl;
    }
   else
   {
cout << \"You made an A!\" << endl;
}
}
else if (coursePercentage >= 80 && coursePercentage <= 89)
{
cout << \"You made a B!\" << endl;
}
else if (coursePercentage >= 70 && coursePercentage <= 79)
{
cout << \"You made a C!\" << endl;
}
else if (coursePercentage >= 60 && coursePercentage <= 69)
{
cout << \"You made a D. Recitation is mandatory for you.\" << endl;
}
else if (coursePercentage < 60)
{
cout << \"You made a F. Recitation is mandatory for you.\" << endl;
}
return 0;
}

char getGrade(double coursePercentage){
   if (coursePercentage >= 90 )
       return \'A\';
   else if (coursePercentage >= 80 && coursePercentage <= 89)
        return \'B\';
    else if (coursePercentage >= 70 && coursePercentage <= 79)
       return \'C\';
    else if (coursePercentage >= 60 && coursePercentage <= 69)
       return \'D\';
   else
       return \'F\';
}

Given a basic template to calculate a course average you must revise the program to do the following. 1.Take in the students name 2.Make the program match the i
Given a basic template to calculate a course average you must revise the program to do the following. 1.Take in the students name 2.Make the program match the i
Given a basic template to calculate a course average you must revise the program to do the following. 1.Take in the students name 2.Make the program match the i

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site