60 438
Assignments Done
98,1%
Successfully Done
In April 2018

# Answer to Question #16204 in C# for valarie

Question #16204
Create a program that will prompt an end user to input 5 float-type values, then calculate the mean, the variance and the standard deviation. I am so lost, need any help avaiable.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
double[] array1 = new double[5];
for (int i = 0; i &lt; 5; i++)
{
Console.Write(&quot;Enter value for &quot; + (i + 1).ToString() + &quot;: &quot;);
}
Console.WriteLine(&quot;Mean= &quot; + ArithmeticMean(array1, 5).ToString());
Console.WriteLine(&quot;Standard Deviation= &quot; + StandardDeviation(array1, 5).ToString());
Console.WriteLine(&quot;Variance= &quot; + Variance(array1, 5).ToString());
}

static double StandardDeviation(double[] data, int items)
{
int i;
double SD, mean, devMean;
double[] deviation = new double[items];

mean = ArithmeticMean(data, items);

for (i = 0; i &lt; items; i++)
{
deviation[i] = Math.Pow((data[i] - mean), 2);
}

devMean = ArithmeticMean(deviation, items);
SD = Math.Sqrt(devMean);

return SD;
}
static double ArithmeticMean(double[] data, int items)
{
int i;
double mean, sum;

sum = 0.0;

for (i = 0; i &lt; items; i++)
{
sum += data[i];
}

mean = sum / (double)items;
return mean;
}
static double Variance(double[] data, int items)
{
int i;
double variance, mean;

double[] deviation = new double[items];

mean = ArithmeticMean(data, items);

for (i = 0; i &lt; items; i++)
{
deviation[i] = Math.Pow((data[i] - mean), 2);
}

variance = ArithmeticMean(deviation, items);

return variance;
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!