Write a program that takes as input five numbers and outputs the mean (average)
ID: 674125 • Letter: W
Question
Write a program that takes as input five numbers and outputs the mean (average) and standard deviation of the numbers. If the numbers are X x2, x3, x4, and x5, then the mean is x = (x1 + x2 + x3 + x4 + x5)/5 and the standard deviation is: S = squareroot(X1-X)^2 + (x2-x)^2 + (x3-x)^2+(x4-x)^2 + (x5-x)^2 Your program must contain at least the following functions: a function that calculates and returns the mean and a function that calculates the standard deviation. The following formula gives the distance between two points. (x1, y1) and (x2. Y2) in the Cartesian plane: squareroot(x2-x1)^2 + (y2-y1)^2 Given the center and a point on the circle, you can use this formula to find the radius of the circle. Write a program that prompts the user to enter the center and a point on the circle. The program should then output the circle's radius, diameter, circumference, and area. your program must have at least the following functions: distance: This function takes as its parameters four numbers that represent two points in the plane and returns the distance between them. radius: This function takes as its parameters four numbers that represent the center and a point on the circle, calls the function distance to find the radius of the circle, and returns the circle's radius. circumference: This function takes as its parameter a number that represents the radius of the circle and returns the circle's circumference. (If r is the radius, the circumference is 2pir. ) area: This function takes as its parameter a number that represents the radius of the circle and returns die circle's area. (If r is the radius, the area is pir^2. )Assume that pi = 3. 1416.Explanation / Answer
1) #include <iostream>
#include <cmath>
using namespace std;
int main ()
{
float numberOne;
float numberTwo;
float numberThree;
float numberFour;
float mean;
float standardDeviation;
numberOne = 1;
numberTwo = 2;
numberThree = 3;
numberFour = 4;
mean = (numberOne + numberTwo + numberThree + numberFour) / 4;
standardDeviation = ;
cout << "Input your first number." << numberOne << endl;
cout << "Input your second number." << numberTwo << endl;
cout << "Input your third number." << numberThree << endl;
cout << "Input your fourth number." << numberFour << endl;
mean = (numberOne + numberTwo + numberThree + numberFour) / 4;
cout << "The mean is " << mean << "and the standard deviation is " << standardDeviation << "." << endl;
return 0;
}
2)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.