Answer to Question #272203 in C++ for matetemaake

Question #272203

Create a base class called Subject



This class must have the following data members:



A c-string subject code that will hold a 7 character code, for example “TPG11BT”. A Boolean exam entry indicator that will hold a value indicating whether or not exam entry has been obtained for the subject.An array for storing test marks.A year mark for storing the calculated year mark or predicate



This class must have the following methods:A public default constructor that sets the data members to appropriate default



values.A copy constructor.A private calcYearMark method that calculates and stores a year mark obtained on a subject. A year mark of 40% or more is needed in order to obtain exam entry; adjust the exam entry indicator accordingly based on year mark

1
Expert's answer
2021-11-27T11:34:20-0500
  #include <iostream>


using namespace std;
class Subject{
public:
    char subjectCode[8]={'T','P','G','1','1','B','T'};
    bool examEntry;
    int testMarks;
    float yearMark;
    subject(){
    cout<<"Enter the subjects done by the student"<<endl;
    cin>>subjectCode[8];
    examEntry=true;
    examEntry=false;


if (true){
    for(int i=0;i<8;i++){
        cout<<"Enter the exam mark"<<endl;
        cin>>testMarks;
    }


    yearMark+=testMarks/8;
    if(yearMark>40){
        cout<<"Pass"<<endl;


    }else(yearMark<40);{
    cout<<"Fail"<<endl;
    }}else(false);{
    cout<<"No exam entry"<<endl;
}}};


int main()
{
    Subject s;
    s.subject();
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS