Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 #include "GradedActivity.h" using namespace std;

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"<30); Validation of 'correctLength' points do { if(correctLength>20) { cout<<"CorrectLength<=20"<20); Validation of 'spelling' points. do { if(spelling>20) { cout<<"Spelling<=20"<20);

Validation of 'content' points

do { if(content>30) { cout<<"30); }

//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 //include Essay header file #include "Essay.h" using namespace std;

/* 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

3rd Edition

0760049041, 978-0760049044

More Books

Students also viewed these Databases questions

Question

What is the growth rate of GDP per capita?

Answered: 1 week ago