Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello! I am wondering if I could please have help from an advanced programmer. T

ID: 3626138 • Letter: H

Question

Hello!

I am wondering if I could please have help from an advanced programmer.

The following question.

Q1. This is for the implementation of the menu options 4. and 5..
When menu option 4. is selected, the program will calculate and display the standard deviation of all the available marks, before returning to the menu. When menu option 5. is selected, the program will allow you to delete one instance of the mark you want to delete, unless the mark doesn't exist.

We recall that for a set of n values, x1, x2, x3, ..., xn-1, xn, its average µ (also denoted by an overline like x above the vector name x) or mean and the corresponding standard deviation s are defined by
µ = ( x1 + x2 + x3 + ... + xn-1 + xn )/n,
s2 = ( (x1 -µ)2 + (x2 -µ)2 + ... + (xn- µ)2 )/n
For a list of 3 marks 56.5, 64.5 and 57, for instance, then the number n of the marks is 3, the average µ of these marks and the standard deviation s are
µ= (56.5 + 64.5 + 57)/3 = 59.33,
s = ( ((56.5-59.33)2+(64.5-59.33)2+(57-59.33)2)/3 )1/2 = 3.6591.

Do I really need to put in the conversions??

Thanks heaps if you understnad this!!!

Explanation / Answer

#include<iostream>
using namespace std;
float average(float a[],int k)
{
      float sum=0;
      for(int i=0; i<k; i++)
      sum = sum+a[i];
      return (sum/k);
     
}
float stad(float a[],int k)
{
      float sd = 0;
      float avg = average(a,k);
      for(int i=0; i<k; i++)
      sd = sd + (a[i]-avg)*(a[i]-avg);
     
      return sd/k;
}
int main()
{
float a[] = {56.5, 64.5 ,57};

cout << "average is given by " << average(a,3)<<endl;
cout << "standard deviation is given by " << stad(a,3)<<endl;

system("pause");
return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote