Design an Essay class that is derived from the GradedActivity class: class GradedActivity{ private: double score; public: GradedActivity() {score = 0.0;} GradedActivity(double s) {score = s;} void setScore(double s) {score = s;} double getScore() const {return score;} char getLetterGrade() const; }; char GradedActivity::getLetterGrade() const{ char letterGrade; if (score > 89) { letterGrade = 'A'; } else if (score > 79) { letterGrade = 'B'; } else if (score > 69) { letterGrade = 'C'; } else if (score > 59) { letterGrade = 'D'; } else { letterGrade = 'F'; } return letterGrade; } The Essay class should determine the grade a student receives on an essay. The student's essay score can be up to 100, and is made up of four parts:   Grammar: up to 30 points   Spelling: up to 20 points   Correct length: up to 20 points   Content: up to 30 points   The Essay class should have a double member variable for each of these sections, as well as a mutator that sets the values of these variables. It should add all of these values to get the student's total score on an Essay. Demonstrate your class in a program that prompts the user to input points received for grammar, spelling, length, and content, and then prints the numeric and letter grade received by the student.   I just need the numeric grade my code: #include   using namespace std;   class GradedActivity {   private:   double score;   public:   GradedActivity()   { score = 0.0; }   GradedActivity(double s)   { score = s; }   void setScore(double s)   { score = s; }   double getScore() const   { return score; }   char getLetterGrade() const;   };   char GradedActivity::getLetterGrade() const {   char letterGrade;   if (score > 89) {   letterGrade = 'A';   } else if (score > 79) {   letterGrade = 'B';   } else if (score > 69) {   letterGrade = 'C';   } else if (score > 59) {   letterGrade = 'D';   } else {   letterGrade = 'F';   }   return letterGrade;   }   class Essay :public GradedActivity {   private:   //scores for various sections   double grammar_Score,spelling_Score,length_Score,content_Score;   public:   double getgrammar_Score()const {   return grammar_Score;   }   void setgrammar_Score(double s) {   grammar_Score = s;   }   double getspelling_Score()const {   return spelling_Score;   }   void setspelling_Score(double s) {   spelling_Score = s;   }   double getlength_Score()const {   return length_Score;   }   void setlength_Score(double s) {   length_Score = s;   }   double getcontent_Score()const {   return content_Score;   }   void setcontent_Score(double s) {   content_Score = s;   }   char getGrade() {   double score = grammar_Score + spelling_Score + length_Score + content_Score;   setScore(score);   char grade = getLetterGrade();   return grade;   }   };   int main() {   Essay essay;   double grammar_Score,spelling_Score,length_Score,content_Score;   cout<<"Enter points received for grammar:";   cin>>grammar_Score;   essay.setgrammar_Score(grammar_Score);   cout<<"Enter points received for spelling:";   cin>>spelling_Score;   essay.setspelling_Score(spelling_Score);   cout<<"Enter points received for correct length:";   cin>>length_Score;   essay.setlength_Score(length_Score);   cout<<"Enter points received for content:";   cin>>content_Score;   essay.setcontent_Score(content_Score);   cout<<"Numeric Grade: " <

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Design an Essay class that is derived from the GradedActivity class:

class GradedActivity{
private:
double score;
public:
GradedActivity()
{score = 0.0;}
GradedActivity(double s)
{score = s;}
void setScore(double s)
{score = s;}
double getScore() const
{return score;}

char getLetterGrade() const;
};

char GradedActivity::getLetterGrade() const{
char letterGrade;

if (score > 89) {
letterGrade = 'A';
} else if (score > 79) {
letterGrade = 'B';
} else if (score > 69) {
letterGrade = 'C';
} else if (score > 59) {
letterGrade = 'D';
} else {
letterGrade = 'F';
}

return letterGrade;
}

The Essay class should determine the grade a student receives on an essay. The student's essay score can be up to 100, and is made up of four parts:

 

    • Grammar: up to 30 points

 

    • Spelling: up to 20 points

 

    • Correct length: up to 20 points

 

    • Content: up to 30 points

 



The Essay class should have a double member variable for each of these sections, as well as a mutator that sets the values of these variables. It should add all of these values to get the student's total score on an Essay.

Demonstrate your class in a program that prompts the user to input points received for grammar, spelling, length, and content, and then prints the numeric and letter grade received by the student.

 

I just need the numeric grade

my code:

#include <iostream>

 

using namespace std;

 

class GradedActivity

{

 

private:

 

double score;

 

public:

 

GradedActivity()

 

{

score = 0.0;

}

 

GradedActivity(double s)

 

{

score = s;

}

 

void setScore(double s)

 

{

score = s;

}

 

double getScore() const

 

{

return score;

}

 

char getLetterGrade() const;

 

};

 

char GradedActivity::getLetterGrade() const

{

 

char letterGrade;

 

if (score > 89)

{

 

letterGrade = 'A';

 

}

else if (score > 79)

{

 

letterGrade = 'B';

 

}

else if (score > 69)

{

 

letterGrade = 'C';

 

}

else if (score > 59)

{

 

letterGrade = 'D';

 

}

else

{

 

letterGrade = 'F';

 

}

 

return letterGrade;

 

}

 

class Essay :public GradedActivity

{

 

private:

 

//scores for various sections

 

double grammar_Score,spelling_Score,length_Score,content_Score;

 

public:

 

double getgrammar_Score()const

{

 

return grammar_Score;

 

}

 

void setgrammar_Score(double s)

{

 

grammar_Score = s;

 

}

 

double getspelling_Score()const

{

 

return spelling_Score;

 

}

 

void setspelling_Score(double s)

{

 

spelling_Score = s;

 

}

 

double getlength_Score()const

{

 

return length_Score;

 

}

 

void setlength_Score(double s)

{

 

length_Score = s;

 

}

 

double getcontent_Score()const

{

 

return content_Score;

 

}

 

void setcontent_Score(double s)

{

 

content_Score = s;

 

}

 

char getGrade()

{

 

double score = grammar_Score + spelling_Score + length_Score + content_Score;

 

setScore(score);

 

char grade = getLetterGrade();

 

return grade;

 

}

 

};

 

int main()

{

 

Essay essay;

 

double grammar_Score,spelling_Score,length_Score,content_Score;

 

cout<<"Enter points received for grammar:";

 

cin>>grammar_Score;

 

essay.setgrammar_Score(grammar_Score);

 

cout<<"Enter points received for spelling:";

 

cin>>spelling_Score;

 

essay.setspelling_Score(spelling_Score);

 

cout<<"Enter points received for correct length:";

 

cin>>length_Score;

 

essay.setlength_Score(length_Score);

 

cout<<"Enter points received for content:";

 

cin>>content_Score;

 

essay.setcontent_Score(content_Score);

 

cout<<"Numeric Grade: " <<essay.getScore();

cout<<"Letter Grade: "<<essay.getGrade();

 

}

Print
Content
V CODELAB ANALYSIS: LOGICAL ERROR(S)
Results Support
Problems Detected:
The contents of your standard output is incorrect.
Given the following was entered from the keyboard:
20
15
134
21d
you displayed:
Enter points received for grammar:Enter points received for-spelling:Enter points received for correct length:Enter points received fo
instead of:
Enter-points-received-for-grammar:Enter-points-received for-spelling:Enter-points-received for-correct-length:Enter points-received fo
Letter Grade: Dd
Falled 3 out of 3 test runs.
Failed Test Run #1(
The contents of your standard output is incorrect.
Interactive Session - W»
Hide Invisibles
Highlight: None
Show Highlighted Only O
Expected Result:
Enter-points-received-for grammar:20
Enter-points-received-for-spelling:15-
Enter-points-received- for-correct length:134
Enter points-received-for content:21-
Numeric-Grade:69
Your Code's Actual Result:
Enter points-received -for grammar:20-
Enter points received for spelling:154
Enter points-received for correct length:13-
Enter points received for content:214
Numeric Grade:Letter Grade: D
Letter Grade: -De
Transcribed Image Text:Print Content V CODELAB ANALYSIS: LOGICAL ERROR(S) Results Support Problems Detected: The contents of your standard output is incorrect. Given the following was entered from the keyboard: 20 15 134 21d you displayed: Enter points received for grammar:Enter points received for-spelling:Enter points received for correct length:Enter points received fo instead of: Enter-points-received-for-grammar:Enter-points-received for-spelling:Enter-points-received for-correct-length:Enter points-received fo Letter Grade: Dd Falled 3 out of 3 test runs. Failed Test Run #1( The contents of your standard output is incorrect. Interactive Session - W» Hide Invisibles Highlight: None Show Highlighted Only O Expected Result: Enter-points-received-for grammar:20 Enter-points-received-for-spelling:15- Enter-points-received- for-correct length:134 Enter points-received-for content:21- Numeric-Grade:69 Your Code's Actual Result: Enter points-received -for grammar:20- Enter points received for spelling:154 Enter points-received for correct length:13- Enter points received for content:214 Numeric Grade:Letter Grade: D Letter Grade: -De
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY