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

1. Write a void function this passed three integers by reference. The function s

ID: 3556421 • Letter: 1

Question

1. Write a void function this passed three integers by reference. The function should rearrange the parameter values so that the first parameter will get the smallest value; the second parameter the middle value; and the third parameter the largest value. Because this is a void function there is no return value.

2. This is actually a single question but requires two functions. Write two overloaded functions to calculate areas.Both should be called area and should return a double. The first will calculate the area of a circle using double that is passed to it that represents the radius.The second will calculate the area of a rectangle using two doubles that are passed to it. These functions should check that the values passed are non-negative.

Explanation / Answer

Dear,

1.
void functionNew(int *a, int *b, int*c)
{
   int small, large, mid;
// Locic to find small
   if(*a<*b)
    {   if (*b<*C)
           small =*a;
       else
          small=*c;
     }  
    else
     { if (*b<*C)
           small =*b;
       else
          small=*c;
     }
    // Locic to find small
   if(*a>*b)
    {   if (*b>*C)
           large=*a;
       else
          large=*c;
     }  
    else
     { if (*b>*C)
           large =*b;
       else
          large=*c;
     }
    *a=small;
    *b=(small+large)/2;
    *c= large;

}
2.
double Area(double radius)
{
   return 3.14*radius*radius;
}

double Area(double len, double wid)
{
   if( len>0 && wid>0)
      return len*wid;
   else
      return 0;
}