Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I/ write the required preprocessor directives I/ declare an integer constant named COLUMNS and initialize to 5 I/ The following methods receive a two dimension

image text in transcribed
image text in transcribed
I/ write the required preprocessor directives I/ declare an integer constant named COLUMNS and initialize to 5 I/ The following methods receive a two dimension integer 1/ array and the size of the first dimension as parameters void fillTwodim(???); int addTwoDim(???); float average(???); void printTwoDim(???); void personalinfo(); // This method has no parameters or return value int main()\{ 1/ declare an integer constant named Rows and initialize to 3 1/ declare a two dimension intger array named numbers using the 1/ constants as the size and initialize all elements to 0 // call the printTwoDim method I/ call the fillTwoDim method to populate the array I/ call the printTwoDim method II print the phrase "The average of all values in the array is [averag 1/ Call the appropriate function to obtain the average value. II call the personalinfo method system("pause"); // For Visual studio only! return 0 ; // The fil1TwoDim method receives a two dimension integer array and the size of the 1/ first dimension as parameters and has no return value. If uses the pseudo random // number generator function to assign a value between 0 and 500 to every element of II the array. Make sure to seed the pseudo random number generator before calling the II rand function. The only variables declared in this method are the counters used in II the for iteration control structures. // The addTwoDim method receives a two dimension integer array and the size of the 1/ first dimension as parameters and returns an integer value. Declare the local integer 1/ variable suma and initialize it to 0 . The method implements a nested for iteration 1/ control structure to add all values in the array and returns the sum. 11 The average method receives a two dimension integer array and the size of the // first dimension as parameters and returns a float value. Call the addTwodim method 1/ to obtain the sum and return the average value. 1/ NO VARIABLES ARE DECLARED IN THIS METHOD // The printTwoDim method receives a two dimension integer array and the size of the 1/ first dimension as parameters and has no return value. It prints the contents of 1/ the array in a matrix format where a tab space is inserted before each value. 1/ First, print the phrase "The values stored in the two-dimension array are:" 1/ Then print the contents of the array using the tab space as described above. // Make sure to add a blank line after all values are printed. 1/ The personalinfo method prints a statement with your personal information using 1/ where the square brackets and the text within is substituted with your personal 1/ information. Make sure to add a blank line after the phrase is printed

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

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions