Question: Problem Write a printData() function that takes an array of doubles along with its size as inputs, prints the entire array: each element should be

Problem

Write a printData() function that takes an array of doubles along with its size as inputs, prints the entire array: each element should be printed on a single line in a user friendly manner. You must use a for() loop in printData(). Remember, you are responsible for determining the number and types of parameters needed and what to return.

Then write a function called calculateSum() or calculateAverage() that takes an array of doubles along with its size as inputs from the caller, calculates the sum or the average, respectively, of all entries in that array and returns the result back to the caller. Remember, you are responsible for determining the number and types of parameters needed and what to return.

Also write a function called findMaximum() or findMinimum() that will take an array of doubles along with its size as inputs, finds the element that has maximum or minimum value, and returns it to the caller. Remember, you are responsible for determining the number and types of parameters needed and what to return.

Print the sum/average and maximum/minimum values in your test function.

Then write a function called getDataElements() that obtains the values for 'elements of a doubles array of the caller function' from the user. You can use MAX_NUMBER_OF_INPUTS as capacity of the array. Remember, you are responsible for determining the number and types of parameters needed and what to return.

You can use these test values to get started:

double data[]={4.5, 5.6, 4.5, 19.5, 10.4};

Some code for the test() function is already provided.

#define MAX_NUMBER_OF_INPUTS 10

//Provide Function prototypes here

//Provide definition of your functions here

void test(){

double data[]={4.5, 5.6, 4.5, 19.5, 10.4};

int sizeOfData;

}

int main(){

test();

return 0;

}

.......................................................................................................................

this is my code

.................................................................................................................

#define _CRT_SECURE_NO_WARNINGS

#include

#include

#define MAX_NUMBER_OF_INPUTS 10

//Provide Function prototypes here [4 points]

void banner();

void printData();

int calculateAverage();

int getDataElements();

//Provide definition of your functions here [14 points]

void banner() {

printf("Welcome! ");

}

int getDataElements(){

int data;

printf("please enter data:");

scanf(" %d", &data);

return data;

}

void printData(){

int i;

double total =0;

double data[]={4.5, 5.6, 4.5, 19.5, 10.4};

for( i=0; i<5; i++){

total = data[i];

}

printf(" here is that data %lf ",total);

}

int calculateAverage(){

int data;

int sizeOfData = sizeof(data) / sizeof(double);

return sizeOfData;

}

void findMinimum(){

}

void test() {

//Invoke your functions here [6 points]

banner();

getDataElements();

calculateAverage();

//print the entire array and also print the average, and

printData();

// the minimum values you found below [4+2 points]

findMinimum();

}

int main() {

test();

printData();

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!