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

Directions: 1. Review the function descriptions listed below. 2. In C Language (

ID: 3680953 • Letter: D

Question

Directions:

1.       Review the function descriptions listed below.

2. In C Language (not C++) Write a single program which implements all of the functions assigned, one function at a time.

3.       Your program will include the function implementations as well as the main( ) function that reasonably tests each function assigned. Each function implemented should be called at least twice from the main().

4.       Choose your test values for your function calls thoughtfully. Use the prototypes and values listed.

Program can be written w/o requiring user input; use programmer defined input for the listed test cases.

In C Language (not C++) Write a single program which implements all of the functions assigned, one function at a time.

Write and test the following function to convert feet to inches. The prototype for this function is:

double feetToInches(double val);

Write and test the following function to convert feet to meters. The prototype for this function is:

double feetToMeters(double val);

Write and test the following function to calculate area. The prototype for this function is:

double computeRectangle(double valA, double valB);

Write and test the following function that calculates the distance between two points provided in rectangular coordinates. The coordinates of Point 1 are (x1, y1). The coordinates of Point 2 are (x2, y2). The prototype for this function is:

double distance(double x1, double x2, double y1, double y2);

Write and test the following function that returns the maximum value of the two parameters that are passed to it. The prototype for this function is:

double maximum(double valA, double valB);

Write and test the following function that returns the average of the four parameters that are passed to it. The prototype for this function is:

double mean(double valA, double valB, double valC, double valD);

Write and test the following function that returns “true” if the integer is even and false otherwise. (Consider 0 an even number). The prototype for this function is:

bool isEven(int value);

Write and test a function that draws a line of characters. The function will receive a number between 1 and 20, inclusive, and a character; then it should draw a line of these characters. The function should draw a line using the character and the number as the length of the line. Here is the prototype for this function:

void drawLine(int valA, char valB);

For example, if this function is given the number 3 and the character B as arguments, it should print out BBB. It should use a loop to print out the character, length times.

Write and test a function that receives three values. The function returns true if the third value, valueC, is the product of the first two parameter values: valueA and valueB. The prototype for this function is:

bool isProduct(int valueA, int valueB, int valueC);

Write and test a function that the calculates area of a circle. The function receives one value, radius of type double, and returns the value;

double calcArea(double radius);

Write and test a function that the calculates area of a rectangle. The function receives two values, length and width and returns the value;

double calcArea(double length, double width);

Explanation / Answer

double feetToInches(double val)
{
return (12 * val);
}

double feetToMeter(double val)
{
return (3.28084 * val);
}

double computeRectangle(double valA, double valB)
{

   return (valA * valB);

double distance(double x1, double x2, double y1, double y2);
{
return Math.Sqrt(DistanceSq(x1, y1, x2, y2));
}

double maximum(double valA, double valB);
{
return (valA > valB ? valA : valB)
}

double mean(double valA, double valB, double valC, double valD);
{
return ((valA+valB+valC+valD)/4);
}

bool isEven(int value)
{
return (value % 2) == 0)
}

void drawLine(int valA, char valB)
{
for (int i = 0; i < valA; i++) {
       print.put('-');
   }
  
}

double calcArea(double radius)
{
    return(PI * pow(radius / 2, 2));
}

double calcArea(double length, double width)

{

return (length * width);

}

"

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