Git Product home page Git Product logo

2darrayfun's Introduction

Expected Output

Option 1: Enter number of Rows, Columns, and Range for array values.
Option 2: Enter file name. 
Option 3: Enter -1 to exit. 
Enter (1 or 2 or -1) as your choice: 1

Enter the number of rows : 
3
Enter the number of columns : 

6
Enter the minimum of the range : 
1
Enter the maximum of the range : 
4

-------------------------------------------------------
1: The array in table format
[1]  [3]  [3]  [4]  [4]  [3]  
[1]  [2]  [1]  [3]  [3]  [4]  
[4]  [2]  [1]  [1]  [2]  [2]  
-------------------------------------------------------



-------------------------------------------------------
2: Sum and Average of the entire array
Sum = 44
Average = 2
-------------------------------------------------------



-------------------------------------------------------
3: Sum and Average of each row
Sum of row0 = 18
Average of row0 = 3
Sum of row1 = 14
Average of row1 = 2
Sum of row2 = 12
Average of row2 = 2
-------------------------------------------------------



-------------------------------------------------------
4: Sum and Average of each column
Sum of column0 = 6
Average of column0 = 2
Sum of column1 = 7
Average of column1 = 2
Sum of column2 = 5
Average of column2 = 1
Sum of column3 = 8
Average of column3 = 2
Sum of column4 = 9
Average of column4 = 3
Sum of column5 = 9
Average of column5 = 3
-------------------------------------------------------



-------------------------------------------------------
5: Sum and Average of the major and minor diagonals
Sum of major diagonal = 4
Average of major diagonal = 1
Sum of minor diagonal = 7
Average of minor diagonal = 2
-------------------------------------------------------



-------------------------------------------------------
6: Row and Col with the highest average.
Higest average of row = 3
Higest average of column = 3
-------------------------------------------------------



-------------------------------------------------------
7: Row and Col with the lowest average.
Lowest average of row = 2
Lowest average of column = 1
-------------------------------------------------------


Option 1: Enter number of Rows, Columns, and Range for array values.
Option 2: Enter file name. 
Option 3: Enter -1 to exit. 
Enter (1 or 2 or -1) as your choice: 2
Press 1. To enter the name of the file
Press 2. To use JFileChooser to read data from an input file
Enter (1 or 2)
1
Enter the file name with extension : resource/read.txt

-------------------------------------------------------
1: The array in table format
[5]  [15]  [8]  [5]  [3]  [16]  [9]  [14]  [12]  [14]  [20]  [4]  [17]  [11]  [11]  [11]  [20]  [14]  [16]  [5]  [18]  [12]  [10]  [19]  [17]  [11]  [10]  [2]  [16]  [20]  
[18]  [1]  [11]  [15]  [3]  [7]  [14]  [9]  [15]  [11]  [11]  [18]  [2]  [7]  [16]  [9]  [12]  [19]  [15]  [13]  [4]  [10]  [16]  [5]  [5]  [19]  [5]  [20]  [6]  [10]  
[14]  [16]  [9]  [18]  [12]  [10]  [5]  [12]  [4]  [7]  [16]  [18]  [9]  [5]  [8]  [1]  [14]  [12]  [2]  [16]  [7]  [4]  [9]  [4]  [7]  [9]  [13]  [9]  [14]  [2]  
[4]  [4]  [1]  [11]  [15]  [2]  [3]  [18]  [18]  [3]  [12]  [10]  [17]  [13]  [10]  [7]  [6]  [11]  [7]  [1]  [12]  [20]  [5]  [19]  [11]  [6]  [1]  [20]  [15]  [3]  
[20]  [18]  [20]  [7]  [5]  [11]  [7]  [14]  [11]  [5]  [14]  [5]  [2]  [17]  [13]  [9]  [17]  [13]  [12]  [12]  [11]  [11]  [7]  [10]  [4]  [7]  [14]  [20]  [8]  [17]  
[11]  [7]  [14]  [15]  [9]  [15]  [15]  [10]  [9]  [14]  [9]  [2]  [4]  [5]  [7]  [17]  [17]  [14]  [7]  [6]  [3]  [5]  [7]  [12]  [2]  [13]  [7]  [18]  [2]  [18]  
[19]  [1]  [4]  [2]  [5]  [16]  [1]  [1]  [18]  [8]  [14]  [2]  [9]  [1]  [18]  [7]  [14]  [2]  [8]  [4]  [16]  [5]  [5]  [5]  [2]  [6]  [10]  [3]  [9]  [6]  
[11]  [6]  [19]  [11]  [2]  [12]  [17]  [3]  [3]  [16]  [14]  [7]  [14]  [14]  [3]  [15]  [19]  [12]  [15]  [11]  [3]  [15]  [8]  [16]  [11]  [17]  [5]  [17]  [18]  [6]  
[15]  [18]  [13]  [1]  [15]  [16]  [7]  [9]  [1]  [3]  [19]  [1]  [3]  [20]  [12]  [18]  [2]  [2]  [15]  [3]  [15]  [13]  [10]  [7]  [2]  [19]  [14]  [20]  [10]  [14]  
[3]  [15]  [1]  [6]  [16]  [5]  [15]  [20]  [16]  [9]  [19]  [13]  [17]  [11]  [6]  [14]  [5]  [17]  [15]  [4]  [18]  [1]  [12]  [8]  [11]  [20]  [20]  [8]  [4]  [14]  
[7]  [9]  [9]  [18]  [2]  [2]  [16]  [9]  [15]  [18]  [3]  [4]  [1]  [11]  [17]  [3]  [2]  [15]  [4]  [5]  [14]  [8]  [4]  [9]  [12]  [3]  [1]  [2]  [4]  [4]  
[19]  [16]  [15]  [2]  [7]  [11]  [4]  [3]  [5]  [2]  [4]  [7]  [8]  [5]  [16]  [3]  [7]  [4]  [20]  [12]  [14]  [16]  [15]  [6]  [6]  [7]  [7]  [15]  [2]  [20]  
[11]  [16]  [17]  [17]  [19]  [8]  [5]  [14]  [17]  [11]  [19]  [3]  [9]  [3]  [10]  [18]  [8]  [19]  [7]  [6]  [6]  [13]  [2]  [20]  [2]  [2]  [14]  [12]  [3]  [7]  
[6]  [12]  [12]  [7]  [4]  [9]  [10]  [4]  [4]  [19]  [2]  [16]  [10]  [1]  [6]  [18]  [10]  [1]  [8]  [1]  [1]  [18]  [10]  [9]  [1]  [11]  [2]  [4]  [5]  [11]  
[18]  [12]  [19]  [4]  [9]  [17]  [2]  [17]  [4]  [17]  [12]  [6]  [11]  [1]  [10]  [18]  [12]  [3]  [16]  [12]  [14]  [8]  [9]  [19]  [7]  [9]  [2]  [14]  [8]  [9]  
[15]  [5]  [3]  [10]  [6]  [18]  [20]  [18]  [13]  [1]  [17]  [5]  [20]  [19]  [11]  [2]  [15]  [5]  [5]  [10]  [10]  [13]  [8]  [20]  [3]  [9]  [10]  [4]  [6]  [14]  
[12]  [3]  [12]  [1]  [11]  [9]  [13]  [4]  [14]  [18]  [15]  [19]  [2]  [13]  [9]  [5]  [4]  [15]  [10]  [20]  [19]  [9]  [11]  [17]  [19]  [14]  [19]  [17]  [2]  [11]  
[8]  [1]  [10]  [12]  [12]  [3]  [20]  [20]  [16]  [3]  [3]  [14]  [2]  [2]  [18]  [8]  [10]  [2]  [12]  [4]  [5]  [19]  [2]  [2]  [5]  [20]  [18]  [16]  [1]  [3]  
[15]  [6]  [5]  [12]  [9]  [11]  [8]  [8]  [12]  [16]  [10]  [7]  [2]  [8]  [5]  [3]  [9]  [12]  [4]  [4]  [15]  [2]  [17]  [14]  [8]  [17]  [16]  [18]  [7]  [8]  
[13]  [14]  [9]  [1]  [1]  [6]  [15]  [16]  [14]  [19]  [18]  [8]  [12]  [12]  [8]  [10]  [7]  [8]  [19]  [10]  [18]  [5]  [19]  [4]  [19]  [6]  [3]  [4]  [17]  [19]  
-------------------------------------------------------



-------------------------------------------------------
2: Sum and Average of the entire array
Sum = 6051
Average = 10
-------------------------------------------------------



-------------------------------------------------------
3: Sum and Average of each row
Sum of row0 = 365
Average of row0 = 12
Sum of row1 = 326
Average of row1 = 10
Sum of row2 = 286
Average of row2 = 9
Sum of row3 = 285
Average of row3 = 9
Sum of row4 = 341
Average of row4 = 11
Sum of row5 = 294
Average of row5 = 9
Sum of row6 = 221
Average of row6 = 7
Sum of row7 = 340
Average of row7 = 11
Sum of row8 = 317
Average of row8 = 10
Sum of row9 = 343
Average of row9 = 11
Sum of row10 = 231
Average of row10 = 7
Sum of row11 = 278
Average of row11 = 9
Sum of row12 = 318
Average of row12 = 10
Sum of row13 = 232
Average of row13 = 7
Sum of row14 = 319
Average of row14 = 10
Sum of row15 = 315
Average of row15 = 10
Sum of row16 = 347
Average of row16 = 11
Sum of row17 = 271
Average of row17 = 9
Sum of row18 = 288
Average of row18 = 9
Sum of row19 = 334
Average of row19 = 11
-------------------------------------------------------



-------------------------------------------------------
4: Sum and Average of each column
Sum of column0 = 244
Average of column0 = 12
Sum of column1 = 195
Average of column1 = 9
Sum of column2 = 211
Average of column2 = 10
Sum of column3 = 175
Average of column3 = 8
Sum of column4 = 165
Average of column4 = 8
Sum of column5 = 204
Average of column5 = 10
Sum of column6 = 206
Average of column6 = 10
Sum of column7 = 223
Average of column7 = 11
Sum of column8 = 221
Average of column8 = 11
Sum of column9 = 214
Average of column9 = 10
Sum of column10 = 251
Average of column10 = 12
Sum of column11 = 169
Average of column11 = 8
Sum of column12 = 171
Average of column12 = 8
Sum of column13 = 179
Average of column13 = 8
Sum of column14 = 214
Average of column14 = 10
Sum of column15 = 196
Average of column15 = 9
Sum of column16 = 210
Average of column16 = 10
Sum of column17 = 200
Average of column17 = 10
Sum of column18 = 217
Average of column18 = 10
Sum of column19 = 159
Average of column19 = 7
Sum of column20 = 223
Average of column20 = 11
Sum of column21 = 207
Average of column21 = 10
Sum of column22 = 186
Average of column22 = 9
Sum of column23 = 225
Average of column23 = 11
Sum of column24 = 154
Average of column24 = 7
Sum of column25 = 225
Average of column25 = 11
Sum of column26 = 191
Average of column26 = 9
Sum of column27 = 243
Average of column27 = 12
Sum of column28 = 157
Average of column28 = 7
Sum of column29 = 216
Average of column29 = 10
-------------------------------------------------------



-------------------------------------------------------
5: Sum and Average of the major and minor diagonals
Sum of major diagonal = 112
Average of major diagonal = 5
Sum of minor diagonal = 212
Average of minor diagonal = 10
-------------------------------------------------------



-------------------------------------------------------
6: Row and Col with the highest average.
Higest average of row = 12
Higest average of column = 12
-------------------------------------------------------



-------------------------------------------------------
7: Row and Col with the lowest average.
Lowest average of row = 7
Lowest average of column = 7
-------------------------------------------------------


Option 1: Enter number of Rows, Columns, and Range for array values.
Option 2: Enter file name. 
Option 3: Enter -1 to exit. 
Enter (1 or 2 or -1) as your choice: 2
Press 1. To enter the name of the file
Press 2. To use JFileChooser to read data from an input file
Enter (1 or 2)
2

Data inside file is as follows...

The file you chose was: /Users/nancy/code/GIT/2DArrayAndFun/resourse/TestArrayInput.txt

-------------------------------------------------------
1: The array in table format
[99]  [88]  [77]  
[66]  [55]  [44]  
-------------------------------------------------------



-------------------------------------------------------
2: Sum and Average of the entire array
Sum = 429
Average = 71
-------------------------------------------------------



-------------------------------------------------------
3: Sum and Average of each row
Sum of row0 = 264
Average of row0 = 88
Sum of row1 = 165
Average of row1 = 55
-------------------------------------------------------



-------------------------------------------------------
4: Sum and Average of each column
Sum of column0 = 165
Average of column0 = 82
Sum of column1 = 143
Average of column1 = 71
Sum of column2 = 121
Average of column2 = 60
-------------------------------------------------------



-------------------------------------------------------
5: Sum and Average of the major and minor diagonals
Sum of major diagonal = 154
Average of major diagonal = 77
Sum of minor diagonal = 132
Average of minor diagonal = 66
-------------------------------------------------------



-------------------------------------------------------
6: Row and Col with the highest average.
Higest average of row = 88
Higest average of column = 82
-------------------------------------------------------



-------------------------------------------------------
7: Row and Col with the lowest average.
Lowest average of row = 55
Lowest average of column = 60
-------------------------------------------------------


Option 1: Enter number of Rows, Columns, and Range for array values.
Option 2: Enter file name. 
Option 3: Enter -1 to exit. 
Enter (1 or 2 or -1) as your choice: -1
Exiting...

Process finished with exit code 0

2darrayfun's People

Contributors

nancychauhan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.