Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the Question class that will be the base for a Trivia Game. The header file for this class is provided here . Implement all

  • Implement the Question class that will be the base for a Trivia Game. The header file for this class is provided hereimage text in transcribed. Implement all member functions in a file named question.cpp, which you will turn in. You don't have to turn in question.h since I already have it. Please note that it is important that you do NOT change question.h or I won't be able to compile your program.
  • Create a program (in main.cpp, which you will turn in) that implements the trivia game. The program should create an array of 10 Question objects, one for each trivia question. Make up your own trivia questions on the subject of your choice. To learn how to create and access arrays of objects, refer to section Arrays of Objects in your textbook (13.12 in 9th edition). There is a great example that you can follow there.
  • Detailed specifications:

    Your game should present the user with the 10 questions in a way that you like. How you will present the questions and in which order is up to you, but make sure to follow these requirements:

  • the interface is friendly, not cluttered, with clear directions (ask someone to play your game to see if it is easy to follow)
  • the user is informed whether the answer they enter is right or wrong. If wrong, let them know what the correct answer is.
  • Present the user with a score (number of correct question) at the end.
  • //

    // Question.h

    // Trivia

    //

    #ifndef Question_h

    #define Question_h

    #include

    using namespace std;

    class Question {

    private:

    string question;

    string answer1;

    string answer2;

    string answer3;

    string answer4;

    unsigned short int correctAnswer;

    public:

    Question();

    Question(string question, string ans1, string ans2, string ans3, string ans4,

    unsigned short int correct);

    void setQuestion(string question);

    void setAnswer1(string ans);

    void setAnswer2(string ans);

    void setAnswer3(string ans);

    void setAnswer4(string ans);

    void setCorrect(unsigned short int correct);

    string getQuestion();

    string getAnswer1();

    string getAnswer2();

    string getAnswer3();

    string getAnswer4();

    unsigned short int getCorrectAnswer();

    };

    #endif /* Question_hpp */

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

Students also viewed these Databases questions

Question

A ( n ) _ _ _ _ _ variable is initialized inside a function.

Answered: 1 week ago