Reference no: EM13552132
Program mimics a rudimentary spreadsheet.
The particular spreadsheet in question is constructed with the following GUI. You will be graded to a large extent by how effectively you use arrays and loop processing of those arrays in your solution.
Spreadsheet is constructed from a nine by five grid of IntegerTextFields, labeled with rows numbered 1 through 9 and columns labeled A through E, as depicted to the right.
When the program begins to execute the user is expected to type in the white text fields. For this assignment we will restrict user input to two different options per text field:
1) a valid integer
2) a reference to a different spreadsheet cell so long as that cell contains an integer
The way to reference a different cell is to provide its column (an uppercase letter in the range 'A' through 'E') followed by a single digit in the range from 1 through 9. No blanks or other symbols are acceptable.
When the button (marked "Average rows and columns") is clicked then each row and each column is averaged and the resulting average is placed in the darker (cyan) text field. The picture above shows the result of clicking this button for the particular content shown.
For averaging purposes, the cells that reference other cells borrow the value of the referenced cell.
For instance, in the above example cell D4 contains the String E9. Therefore, whenever the D4 cell is used for averaging (namely averaging row 4 and column D) the value of this cell is treated as 100 because cell E9 contains 100. Any incorrect or empty cell is interpreted as containing zero.
For this 20-point assignment you can display the averages as truncated integers.
Change the averages so that they are rounded to the nearest one hundredth. The example above shows averages in this format.
Change the program so that before the spreadsheet window is displayed, the user sees the window:
The user types integers into both fields, then hits a return key. Upon typing return in either text field your program must replace the initial window with a spreadsheet window like the one near the top of this page. Of course, this page must contain the specified number of rows and columns. You should restrict the number of rows to 1 though 9 and the number of columns to 1 through 26. As before, rows are numbered, beginning with one and columns lettered beginning with A. All cells behave as defined above. The online applet illustrates.