Question: Write a program that creates test attempts by taking two inputs from the users: number of questions in the test Question numbers, space separated that

Write a program that creates test attempts by taking two inputs from the users:
number of questions in the test
Question numbers, space separated that were correct in the TestAttempt.
main.cpp
Reads num of questions in the test from the user.
Read the correct answers for attempt1, which are space separated question numbers which are right.
Read the correct answers for attempt2, which are space separated question numbers which are right.
Print both attempt1 and attempt2. You need to overload the stream << operator to print.
Copy attempt1 into a temp object and print temp. // calls copy constructor
Copy attempt1 into a temp2 object and print temp2.// calls copy constructor
Assign attempt2 to an existing object temp2, and print temp2.// calls assignment operator
Use operator% for attempt1 and attempt2 and print the result.
Use operator^ for attempt1 and attempt2 and print the result.
Class Description
TestAttempt.h
You need to be able to copy test attempts (deep copy) and assign test attempts along with printing your attempt object. So you need to overload the following functions in TestAttempt class.
Member fields:
numQuestions: total number of questions in the test.
results: a dynamic boolean array initialized to false for all the questions and only set to true if user gives a correct answer.
TestAttempt attempt1(8,"12345");
// numOfQuestions =15
// results is an array with fields T T T T T F F F
Member functions:
Constructor: parameterized constructor.
copy constructor: allows copying of test attempt objects.
TestAttempt attempt1(15,"12345");
TestAttempt attempt2= attempt1; // calls copy constructor
TestAttempt attempt2(attempt1); // calls copy constructor
operator=: copies the data from rhs to lhs object (Note: the lhs object should be existing already, if you create a new object it calls copy constructor).
attempt2= attempt1// copies attempt1 into attempt2, uses operator=
outputstream operator: If you use cout with attempt, it prints the results array as follows
cout<

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 Programming Questions!