Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Requirements: Obtain a file name from the user, which will contain data pertaining to a 2D array Create a file for each of the following:

Requirements:

Obtain a file name from the user, which will contain data pertaining to a 2D array

Create a file for each of the following:

averages.txt : contains the overall average of the entire array, then the average of each row

reverse.txt : contains the original values but each row is reversed

flipped.txt : contains the original values but is flipped top to bottom (first row is now the last row etc.)

If the dimensions of array are symmetric (NxN), create a diagonal.txt: contains the array mirrored on the diagonal

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Example files

The input file will be formatted in the following way:

   

Sample file called "input.txt"

4 4 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 

Output to averages.txt

Total average: 8.5 Row 1 average: 2.5 Row 2 average: 6.5 Row 3 average: 10.5 Row 4 average: 14.5 

Output to reverse.txt

4.0 3.0 2.0 1.0 8.0 7.0 6.0 5.0 12.0 11.0 10.0 9.0 16.0 15.0 14.0 13.0 

Output to flipped.txt

13.0 14.0 15.0 16.0 9.0 10.0 11.0 12.0 5.0 6.0 7.0 8.0 1.0 2.0 3.0 4.0 

Since it's symmetric we also get diagonal.txt

1.0 5.0 9.0 13.0 2.0 6.0 10.0 14.0 3.0 7.0 11.0 15.0 4.0 8.0 12.0 16.0 

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_2

Step: 3

blur-text-image_3

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