Key Assignment Final Draft Part 1: Begin with the running program from your Phase 4 Individual Project where the examination question class hierarchy was fully implemented in a menu-driven program. An...

1 answer below »


Key Assignment Final Draft



Part 1:Begin with the running program from your Phase 4 Individual Project where the examination question class hierarchy was fully implemented in a menu-driven program. An exam class was developed to load the exam from a file and display each question to the screen.



Part 2:Modify the program from part 1 to change the menu to the following:



  1. Load an exam

  2. Take an exam

  3. Show exam results

  4. Quit



Choice 1:No functionality change. Load the exam based upon the user's prompt for an exam file.



Choice 2:The program should display a single question at a time and prompt the user for an answer. Based upon the answer, it should track the score based upon a successful answer. Once a user answers the question, it should also display the correct answer with an appropriate message (e.g., "Good job" or "Better luck next time") Upon completion of the exam, the program should return the user to the menu.



Choice 3:The program should display the total points available and the total points scored during that exam. A percentage score should also be displayed. (Optional: if you choose to track which problems were missed, you could display that information for the user.)



Choice 4:No change to this functionality from the Phase 4 IP.


You should consider creating an additional class Student that will track student's score through methods such asaddPointsPossible, addPointsScored, getPointsPossible,andgetPointsScored. You should also enhance your Exam class to include methodsgetPointValueandgetAnswer. You may also want to add a method to only display one question at a time, such asdisplayQuestion.






----------------------------------------------------------------------------------------------------------------------------------------


The issue I need fixed is a debugging issue. The TF questions are cutting out the first word in the question and the MC questions are cutting out the options. Ultimately, the entire code, compile, and run needs to display an output that allows the user to load an exam, take the exam, display the exam results, and quit the exam. I have provided the current code that I am having issues with, the output file that the exam will be generated from , and screenshots of the TF question not displaying the first word and the MC questions not displaying all of the options. This needs to be fixed.

Answered Same DayDec 14, 2021

Answer To: Key Assignment Final Draft Part 1: Begin with the running program from your Phase 4 Individual...

Aditya answered on Dec 15 2021
151 Votes
#include
#include
#include
#include
#include
#include
using namespace std;
class Question
{
private:
    string question, answer;

    int value;
    string questiontype;
public:
    Question(){};
    Question(string theQuestion, int pointValue)
    {
        question=theQuestion;
value=pointValue;
    }
string getQuestion()
    {
        return question;
    }
    virtual void setQuestion(string answer, int value)
    {
    }
    virtual void setNewQuestion(string answer, int value)
    {
    }
int getValue()
    {
        return value;
    }
    virtual string printOptions(){return "";};
    virtual string getAnswer() {return "";};
};
class QuestionTF : public Question
{
private:
    string answer;
public:
    QuestionTF(string theQuestion, int pointValue, string theAnswer) : Question(theQuestion, pointValue)
    {
    answer = theAnswer;
    }
    string printOptions()
    {
    return "True / False";
    }
    string getAnswer()
    {
    return answer;
    }
};
class QuestionMC : public Question
{
private:
string answer;
    string options[6];
public:
    QuestionMC(string theQuestion, int pointValue, string theAnswer) : Question(theQuestion, pointValue)
    {
    answer = theAnswer;
    for (int i=0; i<6; i++)
    {
    options[i] = "";
    }
    }
    void addOption(string anOption,int i)
    {
                options[i] = anOption;
    }
    string printOptions()
    {
        string str = "";
        for (int i=0; i<6; i++)
        {
                str = str + (char)(65+i) + "." + options[i] + "\n";
        }
        return str;
    }
    string getAnswer()
{
return answer;
}
};
class Student
{
private:
    int pointsAvailable;
    int pointsScored;
public:
    Student()
    {
        pointsAvailable = 0;
        pointsScored = 0;
}
void SetPointsScored(int point)
{
        pointsScored = point;
    }
    int GetPointsScored()
    {
    return pointsScored;
    }
    void SetPointsAvailable(int point)
    {
        pointsAvailable = point;
    }
    int GetPointsAvailable()
    {
        return pointsAvailable;
    }
};
class...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here