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...


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()=""><>
cout < "the="" letter="" grade="" is:="">
cout < quiz.getlettergrade()=""><>




____________________________________________________________________________________________________________________________________________________________________________________________________________


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() <>


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() <>


gaPtr = &quiz;

cout < "quiz="" grade:="" "="">< gaptr-="">getLetterGrade() <>





















___________________________________________________


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;


};









Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here