Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives: 1. Practice using one dimensional arrays and functions (with parameters) to implement algorithms to solve a problem. 2. Practice file input. 3. Understand the

Objectives:

1. Practice using one dimensional arrays and functions (with parameters) to implement algorithms to solve a problem.

2. Practice file input.

3. Understand the mathematics of basics statistics: min, max, mean, standard deviation, linear regression and correlation.

4. Be able to write a C++ program to compute basic statistics.

Instructions:

1. Read the data file which contains two fields, the x and y coordinates. Do NOT ask the user to enter the filename. The first line contains the number of coordinates in the file.

2. As you read the file, load the x coordinates into one array and the y coordinates into another array.

3. Print out all values. All couts must be in the main part of the program. Format is up to you. Be sure you are descriptive.

4. No global variables.

5. Make sure you add a system(pause) before the return and before any exits.

6. Add comments and white space as needed.

7. Use the formulas as shown below.

Formulas:

Given data sets: X = {x0, x1, ..., xn-1}, Y = {y0, y1, ..., yn-1}

image text in transcribed

image text in transcribed

Functions

Below are the function prototypes of the functions you must create. You are free to use your own variable names. You may create other functions if needed.

Note: n is the number of entries in the array, z[ ] is an array which is either x[ ] or y[ ] depending on which is sent to the function. You are to compute the range, mean, and std deviation for both x and y.

void calcRange (double z[ ], int n, double& min, double& max); //Return min & max

double calcMean (double z[ ], int n); // Return the mean of the array

double calcStdDev (double z[ ], int n, double mean); // Return the std deviation of the array

void calcRegression (double x[ ], double y[ ], int n, double& a, double& b); //Returns a and b

double calcCorrelation(double stdDevx, double stdDevy, double a); // Compute correlation coefficient

Input/Output to the Console

Output is up to you. Be sure to print out all fields and make sure they are labeled correctly. Remember all cout must come from the main part of the program. I want to make sure you are passing your values correctly. Sample output:

image text in transcribed

Formula Nanne The Mean (average) ? n-1 Standard Deviation ? n-1 Correlation Equation: y = ax + b Slope a Intercept b

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

Prepare an ID card of the continent Antarctica?

Answered: 1 week ago

Question

What do you understand by Mendeleev's periodic table

Answered: 1 week ago

Question

Advance warning and an explanation for the layoff.

Answered: 1 week ago

Question

Assessment of skills and interests.

Answered: 1 week ago