Question: You are tasked with implementing an enhanced number analysis program. You will be expected to populate a vector with numbers read from the user and
You are tasked with implementing an enhanced number analysis program. You will be expected to populate a vector with numbers read from the user and display various statistics: sum, average, minimum, and maximum.
OUTCOMES
Successfully populate a std::vector from a user by reading from std::cin
Correctly pass and return std::vector to other functions
Use C Standard Library algorithms to assist with computing statistics
Adhere to strict formatting requirements
FILE STRUCTURE
Downloading the handout file will give you a handout.tar file. You can extract the contents of the tar file by providing the following command:
tar xf handout.tar
tar is the name of the command we are running
the x indicates to eXtract
the f indicates there is a File we wish to operate on
handout.tar is the file we wish to extract
The handout will contain several files:
Statistician.h header file for required methods do not change
Statistician.cpp source file for required methods
Driver.cpp source file for driver application
Makefile makefile file to assist with compilation do not change
REQUIRED FUNCTIONS
Statistician.cpp
Finds the largest value in the passed vector
Assumes nums is not empty
float
maximum const std::vector& nums;
Finds the smallest value in the passed vector
Assumes nums is not empty
float
minimum const std::vector& nums;
Finds the sum of values from the passed vector
Should return zero if the vector is empty
float
sumOfValues const std::vector& nums;
Finds the average of all values from the passed vector
assumes nums is not empty
float
average const std::vector& nums;
Creates and returns a new vector. Reads in count number
of values from the user by prompting for each one
should return an empty vector if count
std::vector
populate int count;
Driver.cpp
Entry point to the program
The program should perform the following tasks:
Prompt the user to enter the count of numbers
populate and return a vector with values read from the user
Report the sum, average, min, and max
int
mainint argc, char argv;
SAMPLE INPUTOUTPUT
Enter number of values
Enter value
Enter value
Enter value
Enter value
Enter value
The statistics of all values are:
Sum:
Avg:
Min:
Max:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
