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

Please help me with the correct answers for the following problems. Please run y

ID: 3546026 • Letter: P

Question

Please help me with the correct answers for the following problems. Please run your answer before you post.  Please also make sure theprogram does work. All functions must all have the appropriate parameters. Please comments your code-include pre-condition and post-condition for all functions.

Problem #1


Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and the highest and lowest temperatures for the year. Your program must consist of the following functions:

a. Function getData: This function reads and stores data in the twodimensional array.

b. Function averageHigh: This function calculates and returns the average high temperature for the year.

c. Function averageLow: This function calculates and returns the average low temperature for the year.

d. Function indexHighTemp: This function returns the index of the highest high temperature in the array.

e. Function indexLowTemp: This function returns the index of the lowest low temperature in the array.


Problem # 2


Write a program to calculate students

Explanation / Answer

Problem-5



void print(int a[][7], size_t sz)


but since it's C++, you can use pass-by-reference instead:


template<size_t R, size_t C>

void print(int (&a)[R][C])

{

for(size_t r = 0; r < R; ++r)

{

for(size_t c = 0; c < C; ++c)

std::cout << a[r][c] << ' ';

std::cout << ' ';

}

}


You can call this function simply with the name of the array:


int main()

{

int times[30][7] = {};

print(times);


int students[50][7] = {};

print(students);

}