Question: Need help on C++ H/W. Thanks I already completed Task 1 I just need help updating it for the task 2 below Here is the

Need help on C++ H/W. Thanks

Need help on C++ H/W. Thanks I already completed Task 1 I

I already completed Task 1 I just need help updating it for the task 2 below

just need help updating it for the task 2 below Here is

Here is the code for task 1 that needs to be updated for task 2 below

#include using namespace std;

class EncapsulationDemo { private: int size;

float* nos;

public: // Zero argumented constructor EncapsulationDemo() { } // Parameterized constructor EncapsulationDemo(int size) { this->size = size; nos = new float[size]; }

// getters and setters void setSize(int size) { EncapsulationDemo ed(size); this->size = size; }

int getSize() { return size; } /* Getting the nos entered by the user and * populate those values into an array */ void inputNos() { for (int i = 0; i > nos[i]; } }

// this function will calculate the sum of the array nos float calSum() { float tot = 0.0; for (int i = 0; i

// this function will calculate the average of the array nos float calAvg() { return calSum() / size; }

// this function will display the array nos void displayNos() { cout

// Getting the input entered by the user cout > size;

// creatingan instance of class EncapsulationDemo ed(size);

// calling the functions ed.inputNos(); ed.displayNos(); float sum = ed.calSum(); float avg = ed.calAvg();

// displaying the output cout Use Object Oriented Program design to solve the problems below Encapsulation Example Classes / Methods / etc. Task 1 Write a program that uses an array to find the Average of a set float values entered by the user. You will have the main function control the operation of the program, but all values will be stored in the class. You will need to use get and set methods in your class. Create an array as a member of the class Create 1 method to handle user input. Create 1 method to sum all numbers in array Create 1 method to output the average of all numbers input by the user. Create 1 method to output all the numbers input by the user. Attach Snipping photos of source code and output. Please show output of all methods executing

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!