Question: code is below so its easy to copy and paste......... #include using namespace std; class Data { private: int values[5]; int size = 5; public:

 code is below so its easy to copy and paste......... #include

using namespace std; class Data { private: int values[5]; int size =

5; public: //desc: default zero argument constructor //pre: none //post: values arraycode is below so its easy to copy and paste.........

#include

using namespace std;

class Data

{

private:

int values[5];

int size = 5;

public:

//desc: default zero argument constructor

//pre: none

//post: values array initialized to values 0 to 4

Data()

{

for (int i = 0; i

{

values[i] = i;

}

}

//desc: calculates the sum of the values array

//pre: values is initialized

//post: sum of values array returned

int getSum()

{

int total = -1;

for (int i = 0; i

{

total += values[i];

}

return total;

}

//desc: size accessor function

//pre: size initialized to some value

//post: return size

int getCount() { return size; }

};

//desc: computes the average from the sum and count

//pre: sum and count must be initialized

//post: average is returned

double compute_average(int sum, int count)

{

return sum / count;

}

//desc: main function

//pre: none

//post: average of values array displayed to screen with size of array

int main()

{

Data d;

cout

system("pause"); //may need to replace quote marks if copied

return 0;

}

PART A: DEBUGGING IN VISUAL STUDIO This lab is designed to introduce you to the 1. Copy the following code without changes in to a new project in visual studio. #include using namespace std; class Data private: int values [5]; int size = 5; public: 1/desc: default zero argument constructor //pre: none 1/post: values array initialized to values to 4 Data) for (int i = 0; i using namespace std; class Data private: int values [5]; int size = 5; public: 1/desc: default zero argument constructor //pre: none 1/post: values array initialized to values to 4 Data) for (int i = 0; i

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!