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

Write a computer program to determine the following: (a) Maximum (b) Minimum (c)

ID: 3537751 • Letter: W

Question

Write a computer program to determine the following:

(a) Maximum
(b) Minimum
(c) Range
(d) Mean
(e ) Standard deviation
(f) Variance
(g) Median


Here's my answer but I still miss:

//range=max-min;

// sum1=sum1+(    )*(    );

// median=


//EGR120 PRogramming Assignment
//This program determines the statistic measurements of a sub-set of data.



/* fdjklfdlfhd
sdgsd
sjsjklsfjkl*/

#include<iostream>// for cin, cout
#include<cmath> // for aqrt()

using namespace std;


int main()
{


    /*
    double number1=3.5, number2=2.6, sum;

    cout<<"Hello! Welcome to EGR120!"<<endl;
    cout<<"Let's do math!"<<endl<<endl;

    cout<<"Please enter two numbers"<<endl<<endl;
    cin>>number1>>number2;
    sum=number1+number2;

    cout<<number1<<" + "<<number2<<" = "<<sum<<endl;

    */

    int const size=56;//size is the size of the sample
    double R[size]= {45.3, 67.8, 34.3, 51.2, 48.5, 61.3, 59.3, 65.1,
                     49.3, 42.4, 63.5, 69.8, 71.2, 39.8, 55.5, 53.2,
                     56.7, 48.8, 61.5, 51.2, 58.9, 63.1, 67.5, 62.4,
                     52.4, 50.2, 49.8, 56.8, 59.7, 60.4, 45.8, 43.8,
                     51.3, 54.8, 55.1, 52.3, 56.2, 59.7, 63.0, 46.7,
                     63.1, 58.2, 41.9, 59.2, 57.2, 67.3, 68.2, 38.9,
                     51.3, 63.8, 53.4, 58.9, 56.3, 58.9, 53.2, 56.8};

    double mean,sum=0,temp, min, max, range, variance, std, sum1=0, median;


    //cout<<R[0]<<endl; //print the first element of the array
    //cout<<R[size-1]<<endl; //print the last element of the array

    //Print the array
    cout<<"The raw data:"<<endl;
    for(int k=0; k<=(size-1); k++)
    {
        cout<<R[k]<<endl;
    }
    cout<<endl;

    //Sort data
    for( int m=0; m<=(size-2);m++)// m refer to the number to be compared with
    {
        for(int n=m+1; n<=(size-1);n++)// n refers the numers to compare with m
        {
            if( R[n]>R[m])// sorted in decending
            {
                //swap
                temp=R[n];
                R[n]=R[m];
                R[m]=temp;
            }
        }
    }

    //Print sorted data
    cout<<"The sorted data:"<<endl;
    for(int k=0; k<=(size-1); k++)
    {
        cout<<R[k]<<endl;
    }
    cout<<endl;

    //Print max, min , range
    max=R[0];
    //min=R[size-1];
    //range=max-min; (2)


    //Determine mean
    for(int i=0; i<=(size-1); i++)
    {
        sum=sum+R[i];
    }
    mean=sum/size;

    //Determine variance for sample
    for(int j=0; j<=(size-1); j++)
    {
      // sum1=sum1+(    )*(    ); (3)
    }
    variance=sum1/(size-1);
  
    // Determine standard deviation
    std=sqrt(variance);

    //Determine the median
    if (size%2==0)
    {
        //size is even
       // median=                       (4)


    }
    else
    {
        //size is odd
        median=R[(size-1)/2];

    }


    cout<<"The mean is "<<mean<<endl;
    //cout<<"The maximum is "<<maximum<<endl;            

    //cout<<"The minimum is "<<minimum<<endl;             
    //cout<<"The range is "<<rang<<endl;               
    //cout<<"The median is "<<median<<endl;              
    //cout<<"The variance is "<<variance<<endl;            
    //cout<<"The standard deviation is "<<standard deviation<<endl;  

    system("pause");

}

Explanation / Answer

#include using namespace std; int main() { const int size=56; double sum=0, mean, max=0, min=100, range, variance; double R[size]={45.3, 67.8, 34.3, 51.2, 48.5, 61.3, 59.3, 65.1, 49.3, 42.4, 63.5, 69.8, 71.2, 39.8, 55.5, 53.2, 56.7, 48.8, 61.5, 51.2, 58.9, 63.1, 67.5, 62.4, 52.4, 50.2, 49.8, 56.8, 59.7, 60.4, 45.8, 43.8, 51.3, 54.8, 55.1, 52.3, 56.2, 59.7, 63.0, 46.7, 63.1, 58.2, 41.9, 59.2, 57.2, 67.3, 68.2, 38.9, 51.3, 63.8, 53.4, 58.9, 56.3, 58.9, 53.2, 56.8}; for(int i=0;i
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