Question: I have this code right here, can someone edit this code and add a final score where it calculate the score of the 4 questions,

I have this code right here, can someone edit this code and add a final score where it calculate the score of the 4 questions, it should be out of 100 points. here is the code that i have:

#include "Quiz.h" #include "MCquestion.h" #include "SAquestion.h" #include #include using namespace std;

Quiz::Quiz() { score = 0; question01 = MCquestion(); question02 = SAquestion(); question03 = MCquestion(); question04 = SAquestion(); };

double Quiz::getScore() const { return score; };

void Quiz::startAttempt() { question01.display(); cout << "Enter your choice : "; int choice1; cin >> choice1; if (question01.isCorrect(choice1)) { cout << "Your answer is correct " << endl; } else { cout << "Wrong answer " << endl; }

question02.display(); cout << "Enter your choice : "; string choice2; cin >> choice2; if (question02.isCorrect(choice2)) { cout << "Your answer is correct " << endl; } else { cout << "Wrong answer" << endl; }

question03.display(); cout << "Enter your choice : "; int choice3; cin >> choice3; if (question03.isCorrect(choice3)) { cout << "Your answer is correct " << endl; } else { cout << "Wrong answer" << endl; }

question04.display(); cout << "Enter your choice : "; string choice4; cin >> choice4; if (question04.isCorrect(choice4)) { cout << "Your answer is correct " << endl; } else { cout << "Wrong answer" << endl; } };

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!