Question: Create a class LabCh05SumSubRect that will read information from a data file into a 2D array, as detailed below, and will then ask the user
Create a class LabCh05SumSubRect that will read information from a data file into a 2D array, as detailed below, and will then ask the user for four numbers specifying a sub- rectangle in the array, and will then compute and report the total of all the numbers in that region. Open an input data file named Data5-4 and read the number of rows and number of columns from the first line. Create a 2D array of double that has the required size (for the number of rows and columns given in the file) . Read all the numbers from the input file into the 2D array. . Ask the user for the first row, last row, first column, and last column of the sub-rectangle in the 2D array that they want to total. For example, they might enter 3 6 4 8 meaning they want to total the rectangular sub-region with rows 3 through 6 and columns 4 through 8. . If the values entered do not form a valid sub-rectangle, display an error message and halt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
