First, complete everything that is required of you at the top of the file. Then complete the code wherever it says, "Write your code here ..." according to the comment lines above that line. Test your code using the following input from the keyboard Quiz#1, 3, 3, 1O Quiz#2, 3, 2, 13.5 Quiz#3, 2, 1, 14.5 The expected output can be found at the bottom of the given source file, also shown below. List of quiz activities: Course Activity: Quiz#1 Attempts Available: 3 Attempts Taken: 3 Score: 10.0 Course Activity: Quiz#2 Attempts Available: 3 Attempts Taken: 2 Score: 13.5 Course Activity: Quiz#3 Attempts Available: 2 Attempts Taken: 1 Score: 14.5

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

PLEASE. use it as a template

#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>

using namespace std;

//******************************************************************************
// This is the base class for all course activities.
// Do not change it.
//******************************************************************************
class CourseActivity {
private:
string name;
public:
CourseActivity(string aname): name(aname) {}
string getName() const { return name; }
void setName(string aname) { name = aname; }
void report() const {
cout << "Course Activity: " << name << endl;
}
};

// A declaration of the QuizAssignment class which you'll provide its
// full definition below. Once you have written the class, you can delete
// this line.
class QuizActivity;

//******************************************************************************
// Create a public derived class from CourseActivity named QuizActivity
// with three more member variables for storing the available number of
// attempts, attempts taken, and score.
// Use int for the available number of attempts and attempts taken.
// Use double for the score.
// You need to provide the default constructor and a parameterized constructor.
// You need to provide the accessor and mutator functions for the new
// data members.
// You need to redefine the report member function so that it can print
// the activity name, the available number of attempts, the attempts taken
// and the score.
//******************************************************************************

// Write your code here . . .


// Prototype of the reportQuizActivities function
void reportQuizActivities(const QuizActivity *ptr, int size);

int main() {
// Dynamically create an array of QuizActivity objects using
// the number entered from keyboard.
//
// You can assume the first line of input is a number that tells
// you how big the array should be. Use new to dynamically
// create the array.

// Write your code here . . .


// For each QuizActivity object, set its data members using the
// data extracted from the line of user input.
// Each input line contains comma separated data for
// a lab assignment. For example, a line may look like this.
// Quiz#1, 3, 1, 14.5

// Write your code here . . .


// Call reportGradedAssignments function to print a report of the lab
// assignments

// Write your code here . . .


// Delete the allocated array and reset the pointer

// Write your code here . . .


return 0;
}

//******************************************************************************
//* Function Name: reportQuizActivities
//* Description: This function does a report of the quiz activities from
//* the array of QuizActivity objects it receives.
//*
//* Parameters:
//* ptr - pointer to the first QuizActivity object in the array
//* size - size of the array
//*
//* Return:
//* None
//******************************************************************************

// Write your code here . . .


/*
Use the following lines to test your program:

3
Quiz#1, 3, 3, 10
Quiz#2, 3, 2, 13.5
Quiz#3, 2, 1, 14.5

*/

/*
Here is what the output looks with the test input.

List of quiz activities:

Course Activity: Quiz#1
Attempts Available: 3
Attempts Taken: 3
Score: 10.0

Course Activity: Quiz#2
Attempts Available: 3
Attempts Taken: 2
Score: 13.5

Course Activity: Quiz#3
Attempts Available: 2
Attempts Taken: 1
Score: 14.5

*/

### Reading Data for a Student's Quiz Activities

This exercise involves reading data about a student's quiz activities from the keyboard and displaying a report of the quiz activities using an array of objects of a derived class.

**Steps to Follow:**
1. Complete everything required at the top of the file.
2. Fill in the code where it says, "Write your code here . . ." according to the comment lines above that line.

**Test Your Code:**
Use the following input from the keyboard for testing:

```
3
Quiz#1, 3, 3, 10
Quiz#2, 3, 2, 13.5
Quiz#3, 2, 1, 14.5
```

**Expected Output:**
The expected output for the input provided can be found at the bottom of the given source file, also represented below:

```
List of quiz activities:

Course Activity: Quiz#1
Attempts Available: 3
Attempts Taken: 3
Score: 10.0

Course Activity: Quiz#2
Attempts Available: 3
Attempts Taken: 2
Score: 13.5

Course Activity: Quiz#3
Attempts Available: 2
Attempts Taken: 1
Score: 14.5
```

This structure will help in understanding and debugging the code effectively. Ensure that the report generated matches the expected output for correct implementation.
Transcribed Image Text:### Reading Data for a Student's Quiz Activities This exercise involves reading data about a student's quiz activities from the keyboard and displaying a report of the quiz activities using an array of objects of a derived class. **Steps to Follow:** 1. Complete everything required at the top of the file. 2. Fill in the code where it says, "Write your code here . . ." according to the comment lines above that line. **Test Your Code:** Use the following input from the keyboard for testing: ``` 3 Quiz#1, 3, 3, 10 Quiz#2, 3, 2, 13.5 Quiz#3, 2, 1, 14.5 ``` **Expected Output:** The expected output for the input provided can be found at the bottom of the given source file, also represented below: ``` List of quiz activities: Course Activity: Quiz#1 Attempts Available: 3 Attempts Taken: 3 Score: 10.0 Course Activity: Quiz#2 Attempts Available: 3 Attempts Taken: 2 Score: 13.5 Course Activity: Quiz#3 Attempts Available: 2 Attempts Taken: 1 Score: 14.5 ``` This structure will help in understanding and debugging the code effectively. Ensure that the report generated matches the expected output for correct implementation.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY