CS 1181

CS 1181
Assignment 10

Reading

Liang Chapter 8

Java Application – MinFinder

Create a Java application named MinFinder.java to take a given 2 dimensional array and find the minimum value for each row, column, and the whole array.

A text file named Array.txt contains a 10×10 grid of value for the array:
8.63,1.45,5.56,2.19,9.60,3.79,2.19,2.44,3.25,9.86
4.30,4.53,2.81,8.58,7.09,8.79,1.66,3.18,8.81,1.21
1.99,8.24,7.97,6.30,3.28,8.56,5.14,7.82,8.94,3.33
9.57,8.76,9.04,4.47,6.05,7.71,9.66,8.66,1.42,6.76
9.61,3.84,3.25,3.26,3.66,3.46,3.74,1.72,5.50,6.53
3.21,7.92,3.94,9.35,6.53,4.48,6.67,7.81,7.11,2.14
5.87,2.34,1.05,8.79,6.94,8.81,4.77,4.20,6.92,6.43
8.41,6.74,2.46,3.94,10.00,4.65,8.02,7.56,2.87,6.99
8.92,3.84,4.47,9.82,2.04,3.87,8.04,1.38,7.24,1.35
2.03,1.53,1.62,6.67,7.29,7.28,2.08,6.54,6.31,9.13

Notice the values are separated by commas. Your application should read the values into a two dimensional array.

After the array is created, find the lowest value for each row, column, and the whole grid.

Use modular programming, this means methods. I suggest a method to load the array from the file, and a method to retrieve the smallest number in a row, a method to retrieve the smallest number in a column, etc.

Program output might look like this:

Row 1 : 1.45
Row 2 : 1.21
Row 3 : 1.99
Row 4 : 1.42
Row 5 : 1.72
Row 6 : 2.14
Row 7 : 1.05
Row 8 : 2.46
Row 9 : 1.35
Row 10 : 1.53
Column 1 : 1.99
Column 2 : 1.45
Column 3 : 1.05
Column 4 : 2.19
Column 5 : 2.04
Column 6 : 3.46
Column 7 : 1.66
Column 8 : 1.38
Column 9 : 1.42
Column 10: 1.21
Total : 1.05

Name the Java Class: MinFinder

Grading Rubric

MinFinder.java

• Correct File Name (MinFinder.java) – case sensitive
• Correct Class Name (MinFinder) – case sensitive
• Correct Style – comments
• Correct Style – indentation
• Correct Style – White Space
• Free of syntax errors
• Two dimension field array for values
• Loading values array from Array.txt file
• Check if file exists
• Use try – catch for handling file
• Find and display the correct minimum value for each row
• Find and display the correct minimum value for each column
• Find and display the correct minimum value for the whole grid
Upload

Upload the source code file (MinFinder.java) using your Moodle account for the course into “Assignment 10 Submission”
8.63,1.45,5.56,2.19,9.60,3.79,2.19,2.44,3.25,9.86
4.30,4.53,2.81,8.58,7.09,8.79,1.66,3.18,8.81,1.21
1.99,8.24,7.97,6.30,3.28,8.56,5.14,7.82,8.94,3.33
9.57,8.76,9.04,4.47,6.05,7.71,9.66,8.66,1.42,6.76
9.61,3.84,3.25,3.26,3.66,3.46,3.74,1.72,5.50,6.53
3.21,7.92,3.94,9.35,6.53,4.48,6.67,7.81,7.11,2.14
5.87,2.34,1.05,8.79,6.94,8.81,4.77,4.20,6.92,6.43
8.41,6.74,2.46,3.94,10.00,4.65,8.02,7.56,2.87,6.99
8.92,3.84,4.47,9.82,2.04,3.87,8.04,1.38,7.24,1.35
2.03,1.53,1.62,6.67,7.29,7.28,2.08,6.54,6.31,9.13

This question has been answered.

Get Answer