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

pls help thanks Task 4: Write a function that takes an array of doubles and retu

ID: 3742604 • Letter: P

Question

pls help thanks

Task 4: Write a function that takes an array of doubles and returns the index of the largest value and the index of the smallest value 1. Write the header 2. Write sample calls and expected result for each to test your function 3. Write the body of the function 4. Test your function in XCode Playground Task 5: Write a function that takes an array of doubles and returns their arithmetic mean 1. Write the header 2. Write sample calls and expected result for each to test your function 3. Write the body of the function 4. Test your function in XCode Playground Task 6: Write a function that takes an array of doubles and returns the index of the median value. 1. Write the header 2. Write sample calls and expected result for each to test your function 3. Write the body of the function 4. Test your function in XCode Playground

Explanation / Answer

hi please follow the below functions to define the above scenario

struct Index
{
double Smallest;
double largest;
};

//Function to find the Largest and smallest index value

struct Index * Large_small(double array[])//returns the structure pointer that contains both small and large index
{

      struct Index *large_small;
      int i,length;
      double small,large;
      small=array[0];
      large=array[0];
      length=sizeof(array)/sizeof(double);//To find the length of an array.
      for(i=0;i<length;i++)
      {
if(array[i]<small)
{
     small=array[i];
     large_small->Smallest=small;
}
if(array[i]>large)
{
     large=array[i];
     large_small->largest=large;
        }
      }
      return large_small;//returns the both smallest and largest index value.

}


//Function to find the Arithmetic mean and returns their value

double Arithemetic_mean(double array[])
{

double sum=0,mean;
int i,length;
length=sizeof(array)/sizeof(double);//To find the length of an array.
for(i=0;i<length;i++)
{
sum=sum+array[i];
}
mean=sum/length;
return mean;

}


//Function to return the index of median value

double Arithemetic_mean(double array[])
{

double median_Index,medianvalue;
int length;
length=sizeof(array)/sizeof(double);//To find the length of an array.
median_Index=length/2;
medianvalue=array[median_Index];
return medianvalue;

}