Question

In: Computer Science

Create a C++ program that calculates an unbiased standard deviation of 5 input numbers. Please Submit:...

Create a C++ program that calculates an unbiased standard deviation of 5 input numbers.

Please Submit:

1. A flowchart of your program. (3 points)

2. Your C++ program with a heading comment, also appropriate spacing and indentation in the program body.

3. Copy of a screenshot after your program is executed. (Section 2 and3: 7 points)

/* ELEN 1301 Programming Assignment #8.

Name : Your name.

Student ID : Your student ID #.

Due date :

Purpose of the program : Creating a program that usus an array and calculate an unbiased standard deviation.

Section 1 : Receive a number and store it in an array. We assume there will be always 5 input numbers.

Section 2 : Repeat Section 1 five times.

Section 3 : Find the mean of the five numbers.

Section 4 : Subtract mean from each input that is stored in the array. Square it.

Section 5 : Repeat Section 4 for all the stored input, so that the summention is done.

Section 6 : Divide the sum by (N – 1), in this case it would be 4, and take a square root of the value to show the Standard Deviation.

Solutions

Expert Solution

Here is your C++ program to find out unbiased standard deviation of 5 input numbers.

Please hit that like or thumbs-up button, it really motivates me>3

stdDeviation..cpp

#include <iostream>
#include <cmath>
using namespace std;

float CalstdDeviation(float StoreArr[]);

int main()
{
    int i;
    float StoreArr[5]; // Array to store
    // User input ,limited to 5 only
    cout << "Enter five(5) elements: ";
    for(i = 0; i < 5; ++i)
        cin >> StoreArr[i];

    cout << endl <<"Standard Deviation = " << CalstdDeviation(StoreArr)<<endl;

    return 0;
}
// Function to find out standard deviation
float CalstdDeviation(float StoreArr[])
{
    // variables
    float sum = 0.0, mean, standardDeviation = 0.0;

    int i;

    for(i = 0; i < 5; ++i)
    {
        sum += StoreArr[i];
    }

    mean = sum/5;

    for(i = 0; i < 5; ++i)
        standardDeviation += pow(StoreArr[i] - mean, 2);

    return sqrt(standardDeviation / 5);
}

Output: - Refer to screenshot

Flowchart :- Refer to below image

Again Please hit that like button>3 (I hope you will do that?)

Thank you!!


Related Solutions

Program this using C please The program will read from standard input two things - a...
Program this using C please The program will read from standard input two things - a string str1 on the first line of stdin (this string may be an empty string) - a string str2 on the second line of stdin (this string may be an empty string) Note that stdin does not end with '\n'. The program will output a string that is the concatenation of string str1 and string str2 such that any lower-case alphabet character (a-z) will...
In C Program #include Create a C program that calculates the gross and net pay given...
In C Program #include Create a C program that calculates the gross and net pay given a user-specified number of hours worked, at minimum wage. The program should compile without any errors or warnings (e.g., syntax errors) The program should not contain logical errors such as subtracting values when you meant to add (e.g., logical errors) The program should not crash when running (e.g., runtime errors) When you run the program, the output should look like this: Hours per Week:...
IN C++ PLEASE Requirements Write a program that takes in user input of two integer numbers...
IN C++ PLEASE Requirements Write a program that takes in user input of two integer numbers for height and width and uses a nested for loop to make a rectangle out of asterixes. The creation of the rectangle (i.e. the nested for loop) should occur in a void function that takes in 2 parameters, one for height and one for width. Make sure your couts match the sample output (copy and paste from those couts so you don't make a...
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic:...
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic: Ask for a number, add that number to the front of the list, print the list. Repeat until they enter -1 for the number. . Sample Input: 10, 15, 5, 2, 4, -1 Output: 4, 2, 5, 15, 10. Next sort all the numbers using selection sort and display them. Next give the user option to search for a specific number in the list....
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic:...
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic: Ask for a number, add that number to the front of the list, print the list. Repeat until they enter -1 for the number. . Sample Input: 10, 15, 5, 2, 4, -1 Output: 4, 2, 5, 15, 10. Next sort all the numbers using selection sort and display them. Next give the user option to search for a specific number in the list....
Write a program that calculates mean and standard deviation for four user entered values. The most...
Write a program that calculates mean and standard deviation for four user entered values. The most common measures of a sample are the mean and the standard deviation. the mean is the sum of the values divided by the number of elements in the data set. The dispersion - or spread in the values - is measured by the standard deviation The equation for the mean is x¯ = x1 + x2 + · · · + xn The equation...
in C please! Write a code that asks user for input N and calculates the sum...
in C please! Write a code that asks user for input N and calculates the sum of the first N odd integers. There should be a "pure" method that calculates the sum separately that Main method should call when printing the output.
Create a C # program that calculates what a worker must be paid if each day...
Create a C # program that calculates what a worker must be paid if each day I work different hours during the week. The price per hour is 80.0.
Create a C++ program which will accept an unlimited number of scores and calculates the average...
Create a C++ program which will accept an unlimited number of scores and calculates the average score. You will also need to prompt for the total points possible. Assume each test is worth 100 points. Requirements. • Enter the Student ID first, then prompt for grades. Keep prompt- ing for grades until the client enters ’calc’. That triggers final pro- cessing. • Make your code as reliable as possible. • Make your program output easy to read. • You cannot...
In a certain distribution of​ numbers, the mean is 60​, with a standard deviation of 5....
In a certain distribution of​ numbers, the mean is 60​, with a standard deviation of 5. Use​ Chebyshev's Theorem to tell what percent of the numbers are less than 50 or more than 70.  
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT