Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c + + TwoDArray.cpp Due: Sept 4 by 9 : 0 0 a . m . Program Description: You are working in a biology

in c++
TwoDArray.cpp
Due: Sept 4 by 9:00a.m.
Program Description:
You are working in a biology lab as a data scientist. Your job is to collect and analyze all
data of a special type of bacteria. After a few days of tracking the number of bacteria
growth for each day at the specified temperatures, here are the data generated:
The data you need is presented in a 2-D array format. Therefore, your program should
create a two dimensional array of 4 rows and columns, total of 20 integers.
The array will be filled by the input file bacteria.txt.
Next display all of the values (in a 2-D table format, with rows and columns, format the
display use setw function. Your output format should match my sample output listed
below).
The program should also display the average value of all data (the average should have
two decimals).
The program should display the highest value for all data.
The program should also display the sum for a certain temperature requested (row
sum). You must validate that the row requested is a valid value.
The program should display the lowest value for a certain day (column lowest). You
must validate that the column requested is a valid value.
Program Structure:
Declare two constant variables.
const int ROW_SIZE =4;
const int COL__SIZE =5; //only the column size should be declared as global constant
The following functions must be included, but you may add additional functions if you
wish.
with bacteria.txt file input .
getData This function should pass a two dimensional array, and its row size. The
function fills with the array with the data in the bacteria.txt file.
void getData(int data[][COL_SIZE], const int ROW);displayData This function should be passed by array. The function will display
all grades in the format shown on the back of this page.
void displayData(const int data[][COL_SIZE], const int ROW);
You have to use left setw(5) to manipulate the output
getAllAverage This function should pass the array, the number of rows. The
function should calculate the average for all numbers and return the average
double getAllAverage(const int data[][COL_SIZE], const int ROW_SIZE);
Average of the all numbers must be stored as a "double" type. Please use
static_cast to avoid integer divisions
No display messages in this function.
getAllHighest This function should pass the array, the number of rows. The
function should find the highest for all numbers and return the highest
int getAllHighest(const int data[][COL_SIZE], const int ROW_SIZE);
No display messages in this function.
getRowSum This function should pass the array, the row number requested. The
function should calculate and then return the sum.
int getRowSum(const int data[][COL_SIZE], const int ROW_REQUESTED);
No display messages in this function
Remember array indices always starts from 0, so If ROW_REQUESTED
is 5, you are finding data [4][col]
You can pass the total row size here as a parameter, but it's not necessary.
Why do you think so?(think about it only)
getColLowest This function should be passed an array parameter, the size of the
rows, and the column number requested. It should find the lowest of that column
and then return the value
int getColLowest(const int data[][COL_SIZE], const int ROW_SIZE, const int
COL_REQUESTED);
No display messages in this function
Remember array indices always starts from 0, so If COL_REQUESTED is
2, you are finding data[row][1]
Data Storage:
Data should be stored in a two-dimensional array. Additional variables should be
used as appropriate.
Other Requirements:
Use the provided function headers mentioned above
Your output should be similar to the provided output (attached below), including
format and messages.
Please use setw to format your output
Please use setprecision to restrict your decimal displays to 2 decimal places.
Please follow the program style guidelines carefully
Main function should only call other functions and display messages.Program TwoDArray.cpp Results .
The bacteria data is:
The total for all readings was 2194
The average of all data is: 109.70
The highest value of all data is: 222
Please enter a row number so I can show you the sum of that row: 6
Invalid row number entered; please reenter: 5
Invalid row number entered; please reenter: 4
The sum of row 4 is 42
Please enter a column number so I can show you the lowest value in that
column: 6
Invalid column number entered; please reenter: 5
The lowest of col 5 is 9
C:IUserslcarol|DesktopIStan's Stuff__COSC1560-OA-Programming II -
Fall2024_Program Assignments\Program Assignment 1VAssignment1-
Completed ??? Debug\Assignment.exe (process 12560) exited with code 0.
Press any key to close this window ...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

2. Do the same for your favorite female film character.

Answered: 1 week ago