I have to work on a the source code for a given project and I have finsihed my one set of code for the single dimensional arrays now I am just having a little difficultly figuring out the two dimensional arrays source code. This is what the project requires:
ABC Inc monitors the temperature of each of it seven servers throughout the day. Readings are recorded each hour and the data is reviewed every morning to ensure that temperatures are within operating specs throughout the day. You have been assigned the task of creating a program that provides a quick analysis of each day's data. The data is to be read from a two-dimensional array. There will be twenty-four rows each representing an hour during the day. There are eight columns of numbers. The first seven will represent a server temperature and the seventh will represent the server room's air temperature. The program should display a data analysis that includes:
For each server, the high, low and average temperature during the twenty-four hour period
The difference in temperature between the server room and each of the seven servers for each hour of the day. When the temperature difference is greater than or equal to 50 degrees, mark the entry with an asterisk.
Here is the source code I have to finish:
#include <iostream>
const int NMBROFCLMNS = 8;
const int NMBROFROWS = 24;
void processArray(int TR[][NMBROFCLMNS]);
double avgerage(int [][NMBROFCLMNS], int, int);
int high(int TR[][NMBROFCLMNS], int, int);
int low(int [][NMBROFCLMNS], int, int);
int tempDifference(int [][NMBROFCLMNS], int , int );
void processArray(int temperatures[][NMBROFCLMNS]){
//Create the required tables
//print the table heading
std::cout << "Low / High / Average Temperature Table \n";
std::cout << "Unit" << "\t\tLow" << "\t\tHigh" << "\t\tAVG\n";
//Iterate through each clmn of the array and calculate column stats
for (int clmn = 0; clmn < 8; clmn++) {
std::cout << clmn << "\t\t"
<< low(temperatures,NMBROFROWS,clmn) << "\t\t"
<< high(temperatures,NMBROFROWS,clmn) << "\t\t"
<< avgerage(temperatures,NMBROFROWS,clmn) <<"\n";
};
//calculate and display the temp difference table
tempDifference(temperatures,NMBROFROWS,NMBROFCLMNS);
}
void printColumn(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//prints the values in the given column (TheClmn)
for (int row = 0; row < nmbrOfRows; row++)
std::cout << theArray[row][TheClmn] << " ";
std::cout << std::endl;
}
int low(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//finds the lowest value in the given column of a two-dimensional array
} //end low
int high(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//finds the highest value in the given column of a two-dimensional array
} //end high
double avgerage(int theArray[][NMBROFCLMNS], int nmbrOfRows, int TheClmn){
//finds the average of the values in the given column of a two-dimensional array
} //end average
int tempDifference(int theArray[][NMBROFCLMNS], int nmbrOfRows, int nmbrOfClmns){
//creates a table that contains the difference between
//each computer's temperature and the room temperature
//for each time reading. Mark all differences
//greater than or equal to 50 with an asterisk.
//Formula: differnce = theArray[row][clmn] - theArray[row][7];
} //end temperature Difference
ANY help would be greatly appreciated.!
I NEED TO COME UP WITH THE FORMULAS FOR THE FINDING THE HIGHEST, THE LOWEST, AND THE AVERAGE VALUES and then Find the formula for the difference. The comments in the source code are for the instructions about what need to be found.
As you iterate through each array assign high and low the value of the first element. There after if the next element is higher than high assign high the value of element [1]. do likewise with low.
Similarly maintain a running total of the hourly data and divide it by 24 at the end of each day to get each server average temperature exposure.