A C++ assignment  Implement the GradedActivity class.  Copying from the pdfs is fine. Create a new class Assignment which is derived from GradedActivity.  It should have three private member ints for 3 different parts of an assignment score: functionality (max 50 points), efficiency (max 25 points), and style (max 25 points).  Create member function set() in Assignment which takes three parameter ints and sets the member variables.  It should also set its score member, which is inherited from GradedActivity, using the setScore() function, to functionality + efficiency + style.  Signature: void Assignment::set(int, int, int) Create a main program which instantiates an Assignment, asks the user for its functionality, efficiency, and style scores, and prints out the score and letter grade for the assignment.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 6E
icon
Related questions
Question
100%

A C++ assignment 

  • Implement the GradedActivity class.  Copying from the pdfs is fine.
  • Create a new class Assignment which is derived from GradedActivity.  It should have three private member ints for 3 different parts of an assignment score: functionality (max 50 points), efficiency (max 25 points), and style (max 25 points). 
  • Create member function set() in Assignment which takes three parameter ints and sets the member variables.  It should also set its score member, which is inherited from GradedActivity, using the setScore() function, to functionality + efficiency + style.  Signature:

void Assignment::set(int, int, int)

  • Create a main program which instantiates an Assignment, asks the user for its functionality, efficiency, and style scores, and prints out the score and letter grade for the assignment.

___________________________________________________

Examples from the pdfs

 

d PassFailExam::set(int q, int m, int p) { double numericScore, pointsEach;

numQuestions = q;
numMissed = m;
numToPass = p;
pointsEach = 100.0 / numQuestions;
numericScore = 100.0 - (numMissed * pointsEach);

setScore(numericScore); char PassFailExam::getLetterGrade() const {

if ((numQuestions - numMissed) >= numToPass) return 'P';

else return 'F';

}

 

___________________________________________________

 

 

 

 

class PassFailExam : public GradedActivit { private: int numQuestions; int numMissed; int numToPass; public: PassFailExam()

{ numQuestions = 0; numMissed = 0; numToPass = 0; }

void set(int, int, int); char getLetterGrade() const;

};

 

___________________________________________________

 

class GradedActivity { protected: double score; public: GradedActivity()

{ score = 0.0; } GradedActivity(double s)

{ score = s; }
void setScore(double s)

{ score = s; } double getScore()

{ return score; } char getLetterGrade() const;
 
};
 
___________________________________________________
 
PassFailExam quiz;

quiz.set(10,2,8);
cout << "The score on quiz is: ";
cout << quiz.getScore() << endl;
cout << "The letter grade is: ";
cout << quiz.getLetterGrade() << endl;

 

 

____________________________________________________________________________________________________________________________________________________________________________________________________________

Polymorphism Chapter: 

 

 

class PassFailExam : public GradedActivity

{
private:

int numQuestions; int numMissed; int numToPass; public: PassFailExam()

{ numQuestions = 0; numMissed = 0; numToPass = 0; }

void set(int, int, int); char getLetterGrade() const;
 
};
 
 
 
___________________________________________________

 

int main()

{ GradedActivity HW1; PassFailExam quiz; GradedActivity *gaPtr;

HW1.setScore(80); quiz.set(10,2,8);

gaPtr = &HW1;

cout << "HW1 grade: " << gaPtr->getLetterGrade() << endl;

gaPtr = &quiz;

cout << "quiz grade: " << gaPtr->getLetterGrade() << endl; }

 

___________________________________________________

 

class GradedActivity { private: double score; public: GradedActivity()

{ score = 0.0; } GradedActivity(double s)

{ score = s; }
void setScore(double s)

{ score = s; } double getScore()

{ return score; }
 
char getLetterGrade() const; 
};
 
 
___________________________________________________

int main()

{ GradedActivity HW1; PassFailExam quiz; GradedActivity *gaPtr;

HW1.setScore(80); quiz.set(10,2,8);

___________________________________________________

int main()

{ GradedActivity HW1;
PassFailExam quiz;
GradedActivity *gaPtr;

HW1.setScore(80);

quiz.set(10,2,8);

gaPtr = &HW1;

cout << "HW1 grade: " << gaPtr->getLetterGrade() << endl;

gaPtr = &quiz;

cout << "quiz grade: " << gaPtr->getLetterGrade() << endl;

 

___________________________________________________

class GradedActivity { private: double score; public: GradedActivity()

{ score = 0.0; } GradedActivity(double s)

{ score = s; }
void setScore(double s)

{ score = s; } double getScore()

 

{ return score; }
virtual char getLetterGrade() const;

};

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,