Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Q1, you have to write the function definitions that is, the implementation of the functions listed in the class. So totally you have to

image text in transcribed
image text in transcribed
In Q1, you have to write the function definitions that is, the implementation of the functions listed in the class. So totally you have to write 5 functions: 3 constructors (2 regular, 1 copy), 1 destructor, and 1 classesAtIndex . No need to write main function, to create the object of the class.
classes is a dynamic array which has the students as indexes and the number of classes the students take, as values. For example, if classes was a 100 int array, you have a record of 100 students, where classes[0] will be the number of classes the first student has taken, classes[77] will be the number of classes the 78th student has taken, etc.
classesAtIndex should return the number of classes the (index)th student has taken.
The following class keeps track of how many students are at College A and the number of classes each of them have taken in Spring 2020. The classes for each student are positive values of type unsigned int and are stored as a dynamically allocated array. The first data member is a pointer that will point to the first element of the array. This array will be of an arbitrary size. The default size of the array shall be 50, but may be specified by the user at the time of construction The second data member represents the size of the array, i.e. the number of students at College, and is stored as unsigned int. class Spring 2020 private: unsigned int* classes; unsigned int num; public: // constructors (default, one arg, and copy) Spring2020 (); Spring2020 ( unsigned int numberOfStudents); Spring2020 ( const Spring2020& original); // destructor -Spring2020 (); // Member function int classesAt Index ( int index); 1) If this is in the Class Specification (header) file Spring2020. hpp, write the function definitions that would be in the Class Implementation (source) file Spring2020.cpp. in) Why must the parameter of the copy constructor be of type constant reference? Hint: Recall the discussion in class about constant reference. But this question seeks answers beyond that. Here we are passing constant reference, but as parameter to a copy constructor In Q1, you have to write the function definitions that is, the implementation of the functions listed in the class. So totally you have to write 5 functions: 3 constructors (2 regular, 1 copy), 1 destructor, and 1 classesAtIndex. No need to write main function, to create the object of the class. classes is a dynamic array which has the students as indexes and the number of classes the students take, as values. For example, if classes was a 100 int array, you have a record of 100 students, where classes [O] will be the number of classes the first student has taken, classes[77] will be the number of classes the 78th student has taken, etc. classesAtIndex should return the number of classes the (index)th student has taken

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Identify the types of informal reports.

Answered: 1 week ago

Question

Write messages that are used for the various stages of collection.

Answered: 1 week ago