Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert the attached C++ program into MATLAB. Use the attached Excel file for input, inputting the data manually. The second sheet of the spreadsheet has

Convert the attached C++ program into MATLAB. Use the attached Excel file for input, inputting the data manually. The second sheet of the spreadsheet has the answers that you should be able to create.

#include

#include

using namespace std;

// prototypes

float myMax(float [], float);

float myAvg(float [], float);

int main()

{

int cols = 8;

int rows = 3;

float myArray[rows][cols];

float tempArray[cols], dayMax[rows];

int r1 = 0;

float dayMaxAvg;

while(r1

for(int c = 0; c

cout

c+1

cin >> myArray[r1][c];

}

r1++;

}

for(int r2 = 0; r2

for(int c =0; c

tempArray[c] = myArray[r2][c];

}

dayMax[r2] = myMax(tempArray, cols);

cout

}

dayMaxAvg = myAvg(dayMax, rows);

cout

cout

return 0;

}// end of main

// function finds the maximum value in an array

float myMax(float theArray[], float count){

float maxValue = 0, tempMax;

for(int n = 0; n

if(theArray[n] > maxValue){

maxValue = theArray[n];

}

}

return maxValue;

}

// function finds the average value in an array

float myAvg(float theArray[], float count){

float avgValue, sumOfValues = 0;

for(int n = 0; n

sumOfValues = sumOfValues + theArray[n];

}

avgValue = sumOfValues/count;

return avgValue;

image text in transcribed

747 282 225 900 H122 143 179 129 009 G221 629 905 211 753 125 990 541 857 009 D221 523 090 C212 155 550 B222 651 794 909 A-21 123456789 747 282 225 900 H122 143 179 129 009 G221 629 905 211 753 125 990 541 857 009 D221 523 090 C212 155 550 B222 651 794 909 A-21 123456789

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

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago