Question
Please help!! The below code is not compiling, please fix it. I was using code::block to compile. /*************************************************** * This program demonstrates classes GradedActivity* *
Please help!! The below code is not compiling, please fix it. I was using code::block to compile.
/*************************************************** * This program demonstrates classes GradedActivity* * and Essay Class * ****************************************************/
/*************************************************** * Input : Set points for essay class * * Output : Display total points and grade of an essay* *******************************************************/
#ifndef GradedActivity_H #define GradedActivity_h
class GRADEDACTIVITY
{ //declaring required variables for the class protected: double score;
public: void setScore(double s) { score = s; }
double getScore() { reture score; } };
#ifndef ESSAY_H #define ESSAY_H #include
class Essay : public GradeActivity { protected: char letterGrade; //To hold the letter grade double grammar; //To hold score double spelling; //To hold score double correctLength; //To hold score double content; //To hold score double total;
public: Essay(double grammar, double spelling, double correctLength, double content) { Validation of 'grammer' points. do { if(grammar>30) { cout<<"Grammar<=30"<
Validation of 'content' points
do { if(content>30) { cout<<"
//setter methods to set points void setSpellingScore(double grammar) { this->grammar=grammar; } void setGrammarScore(double spelling) { this->spelling=spelling; } void setcorrectLengthScore(double correctLength) { this->content=content; }
//getter methods to get points double getGrammarScore() { return grammar; } double getSpellingScore() { return spelling; } double getCorrectlengthScore() { return correctLength; } double getContentscore() { return content; }
//method to get total points
double getTotal() { return total; }
//method to grade the points char getGrade() { if(total >= 90) letterGrade = 'A'; else if(score >= 80) letterGrade = 'B'; else if(score >= 70) letterGrade = 'C'; else if(score >= 60) letterGrade = 'D'; else letterGrade = 'F'; return letterGrade; } };
#endif ESSAY_H /* The libraries with console input and output facilities are available to program */
#include
/* main is a function with no parameters that returns an int value */
int main() { //create an object for Essay class Essay essay(30,20,20,20);
//print scores to the console cout<<"Grammar : "< //print total points cout<<"Total Points:"< //print grade of total points cout<<"Grade:"< //pause the system console output system("pause"); return 0; } Thank you
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started