this is the question
Most teachers assign various graded activities for their students to complete. A graded activity can consist of a numeric score such as 65, 89, 93 and so on. GradedActivity class is to hold the numeric score and letter grade of a graded activity. When a numeric score is stored by a class, it automatically determines the letter grade. The class has a default constructor that initializes the score which is a private member variable to 0.0. A second constructor accepts an argument for score. The setscore member function also accepts an argument for the score variable, and the getLetterGrade member function returns the letter that corresponds to the value in score.
finalExam class is derived from the gradedActivity class. It has member variables for the number of question on the exam (numQuest), the number of points each question is worth (pointEach) and the number of question missed by the student (numMissed). The default constructor assigns 0 to each of the class’s member variables. Another constructor accepts two arguments, one for the number questions on the exam and one for the number of questions missed. This constructor merely passes those values as arguments to set which is the class member function. In set function, identify, numQuest and numMissed will be set with those values respectively. Assume that the full mark test is 100 points. The numeric test score is calculated by reducing the full mark with the total marks for the missed questions. Set the numeric test score into score.
Demonstrate the two classes in a main function. So that the following sample output might be produced:
How many questions are on the final exam? 20 [enter]
How many questions did the student miss? 3 [enter]


i've tried n now im so stucked. please help me

Attachments
#include<iostream>
using namespace std;

      class gradedActivity
      {
       public:
              gradedActivity();
              gradedActivity(double thescore,char thegrade);
              void setscore(double newscore);
              void setgrade(char newgrade);
              char getLettergrade();
              double getsetscore();
              
         
        
        
       private:
               double score;
             char grade;
                      
};

gradedActivity::gradedActivity(): score(),grade()
     {
     }
     
     gradedActivity::gradedActivity(double thescore,char thegrade):score(10), grade()
     {
     }
    double gradedActivity::getsetscore()
     {
       return score;
       }
     char gradedActivity::getLettergrade()
     {
       if (score >=90)
        grade='A'; 
        else if(score>=80)
        grade='B';
        else if(score>=70)
        grade='C';
        else if(score>=60)
        grade='D';
        else
        grade='F';
                                    
       return grade;                                                                                               
       }
     
     void gradedActivity::setscore(double newscore)
     {
          score=newscore;
     }
     
     void gradedActivity::setgrade(char newgrade)
     { 
          grade=newgrade;
     
     }
#include<iostream>
#include<cstdlib>
#include "asg3.h"
using std::cout;

void gradedActivity();
int main()
{ 
    double sco;
    char grade;
 
cout <<"enter a numeric test score";
cin >> sco;
     
     cout<<"the grade for the test";
     cout << gradedActivity::grade.getLettergrade() ; 
     
}     ;
#include<iostream>
#include "asg3.h"
using namespace std;

class FinalExam :public gradedActivity
{
      public:
             FinalExam();
             FinalExam(int numQuest,int numMissed);
             double getpointEach();
             int get numMissed();
             void setnumQuest(int quest);
             void setnumMissed(int missed);
             void print();
       private:
               int numQuest;
               int numMissed;
               double pointEach;
               double numericScore;
}
#include<iostream>
#include "asg3.h"
#include "finalexam.h"
using std :: cout;
using namespace std;


      FinalExam::FinalExam():: gradedActivity(),numQuest(),numMissed()
      {
      }
         FinalExam::FinalExam(int numQuest,int numMissed)
         {
          }            
         double getpointEach()
         {
                pointEach=100.0/quest;
                numericScore=100.0-(missed*pointEach);
                return pointEach;
         }
         int getnumMissed()
         {
            return numMissed;
         }
         void setnumQuest(int quest)
         {
             numQuest=quest;
         }
         void setnumMissed(int missed)
         {
             numMissed=missed;
         }
         void FinalExam::print()
         {  
           cout<<"Each question counts" << getpointEach() <<"points";
                         
           cout<<"the exam score is"<< getpointEach()<<"points";
                         
           cout<<"the exam grade is"<< getLettergrade();                                               


}

Please boil your question down to a 20 line, compilable piece of code that we can help you with. If you don't want to do your homework, why would we??

Dave

here is the code

grade.h

#include<iostream>
using namespace std;

      class gradedActivity
      {
       public:
              gradedActivity();
              gradedActivity(double thescore,char thegrade);
              void setscore(double newscore);
              void setgrade(char newgrade);
              char getLettergrade();
              double getsetscore();
              
         
        
        
       private:
               double score;
             char grade;
                      
};

gradedActivity::gradedActivity(): score(),grade()
     {
     }
     
     gradedActivity::gradedActivity(double thescore,char thegrade):score(10), grade()
     {
     }
    double gradedActivity::getsetscore()
     {
       return score;
       }
     char gradedActivity::getLettergrade()
     {
       if (score >=90)
        grade='A'; 
        else if(score>=80)
        grade='B';
        else if(score>=70)
        grade='C';
        else if(score>=60)
        grade='D';
        else
        grade='F';
                                    
       return grade;                                                                                               
       }
     
     void gradedActivity::setscore(double newscore)
     {
          score=newscore;
     }
     
     void gradedActivity::setgrade(char newgrade)
     { 
          grade=newgrade;
     
     }

grade.cpp

#include<iostream>
#include<cstdlib>
#include "grade.h"
using std::cout;


 gradedActivity::gradedActivity(): score(),grade()
     {
     }
     
     gradedActivity::gradedActivity(double thescore,char thegrade):score(10), grade()
     {
     }
    double gradedActivity::getsetscore()
     {
       return score;
       }
     char gradedActivity::getLettergrade()
     {
       if (score >=90)
        grade='A'; 
        else if(score>=80)
        grade='B';
        else if(score>=70)
        grade='C';
        else if(score>=60)
        grade='D';
        else
        grade='F';
                                    
       return grade;                                                                                               
       }
     
     void gradedActivity::setscore(double newscore)
     {
          score=newscore;
     }
     
     void gradedActivity::setgrade(char newgrade)
     { 
          grade=newgrade;
     
     }  
   void gradedActivity:: checkprint()     
     {
     cout <<"enter a numeric test score";
     cin >>score;
     
     cout<<"the grade for the test";
     cout << grade ;                 
     exit(1);                              
     }

i only got this,n now im stucked

Edited 6 Years Ago by WaltP: Added CODE Tags

uh huh... As far as you've posted, you've got nothing in your code... try a little bit harder, take some code snippets as a reference, google some tutorials, and come back when you've got a real CODE issue, ok?

This article has been dead for over six months. Start a new discussion instead.