Question: This is in C++. OBJECTIVES This assignment will exercise the use of OOP classes, accessor function, mutator functions, and arrays of objects. Pat Programmers Awesome

This is in C++.

OBJECTIVES

This assignment will exercise the use of OOP classes, accessor function, mutator functions, and arrays of objects.

Pat Programmers Awesome Quiz-o-matic

Write a program quiz generator program to help students study for quizzes and exams. The program must call a function that reads a set of multiple choice questions from a file, storing the questions in an array of object of the class Question. The class maintains the question text, an array of possible answers, and the correct answer.

After loading the questions, the program should loop through the array prompting the student with the question and checking the students answer. The program should indicate correct to the student, if the answer is correct, otherwise indicate incorrect and display the correct answer (see sample) below.

After all questions have been answered, the program should display the student score in points, and correct score percentage.

The question file format is as follows:

(1) question text?

first possible answer

second possible answer

third possible answer

fourth possible answer

fifth possible answer

x correct answer number.

(2) question text?

first possible answer

second possible answer

third possible answer

fourth possible answer

fifth possible answer

x correct answer number.

(n) question text?

first possible answer

second possible answer

third possible answer

fourth possible answer

fifth possible answer

x correct answer number.

Name your program lastNamePass4.cpp. Your program should meet the following requirements

main()

1.Declare variables and Question array. Use a constant for the number_of_questions.

2.Call initQuestions() function to load array with questions.

3.Use a loop to prompt student with question and read answer.

a.Call displayQuestion to display question.

b.use cin >> ans to read student answer.

c.If the answer is correct, display correct

d.Else display incorrect and then display the correct answer.

e.Increment array index and repeat loop until all questions

4.After all questions have been issues, display student results.

5.You must include a comment at the top of your .cpp file in this format:

/*******************

Author: Pat Programmer

Course: CSCI 2010 Section nn

Program: Pass 4

Description: This program does

*******************/

You should obviously change the name to your name, the section to your section, the system to the system you used, and write a real description of the program

initQuestions()

6.Define a function (initQuestions()) that implements the following logic:

a.Opens questions.txt and checks for a valid open issues error and exits if not successful.

b.Uses a while loop to read the question text, five answers, and the correct answer number. Use setter methods to store the questions in a Question object array. Be certain to protect against data overrunning the array.

displayQuestion()

7.Define a function (displayQuestion())) that displays the question text and possible answers. (See sample run for format).

Question Class

Define a class called Question in its own header file Question.h. Be certain to create an include guard. The UML class diagram is as follows:This is in C++. OBJECTIVES This assignment will exercise the use of

Question Fields correctAnswer apossibleAnswe aquestionText Methods getCorrectAnswer getCorrectNumber getPossAnswer! getPossAnswer2 getPossAnswer3 getPossAnswer4 getPossAnswer5 uestion Question setCorrect setPoss Answer! setPoss Answer2 setPoss Answers setPossAnswer4 setPossAnswer5 setQuestionText 3e5 12345

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!