P1 2390 F'96
A Spreadsheet With An Interface

This problem statement should look really familiar to those of you who have visited the P2's in STABLE. The PDC is the same. The difference is in the HIC. You are welcome to use any and all of the code in STABLE for solving this problem! You may decide to use none of it! Caveat Emptor.

PDC for Spreadsheets

The user needs to create several spreadsheet objects that compute the sum of their entries, the average of their entries, and, as a special case, the sum or average of (1) the results of several spreadsheets or (2) specific cells of two spreadsheets. The user doesn't feel that they need more than single dimension spreadsheets, so cells are specified by integers. The user would like to use these spreadsheets with Workspace code that looks like this:
| ss1 ss2 ss3 ss4 ssArray|
ss1 := Spreadsheet type: #sum.
ss1 cell: 1 put: 15.     "Puts 15 into cell 1"
ss1 cell: 2 put: 30.
ss1 cell: 3 put: 75.2.
Transcript cr; show: ss1 value printstring.  "Prints the sum (120.2) to the Transcript"
Transcript cr; show: (ss1 cell: 1) printstring. "Prints 15 to the Transcript"

ss2 := Spreadsheet type: #average.
ss2 cells: #(24 76.4 19 37 89).  "Fill five cells of the spreadsheets with these values"
Transcript cr; show: ss2 value printstring. "Prints the average (49.08) to the Transcript"

"Create a spreadsheet that sums the values of two Spreadsheets"
ssArray := Array with: ss1 with: ss2.
ss3 := Spreadsheet type: #sum with: ssArray.
Transcript cr; show: ss3 value printstring. "Prints the sum 120.2 + 49.08 to the Transcript"
ss1 cell: 4 put: 89.9.  "Add a fourth cell to ss1."
Transcript cr; show: ss3 value printstring. "Prints the updated values of ss1 and ss2"

"Create a fourth spreadsheet whose value is the average of ss1 cell 2 and ss2 cell 3"
ss4 := Spreadsheet type: #average with: ss1 cell: 2 with: ss2 cell: 3.
Transcript cr; show: ss4 value printstring. "Prints the average of 30 and 19 (24.5)"

Special notes to consider when designing and implementing the SpreadsheetRow class.

HIC for Spreadsheets


The user wants to see:

In the above example, the user would expect to see a window for each of the four spreadsheets. The window should open with the same message that created the spreadsheet (e.g., type: or type:with: or type:with:cell:with:cell:). On each of the windows should be one or more buttons which allow the user to update a cell. If the user changed cell 2 of SS1, then SS1, SS3, and SS4 should all update appropriately.

To do the windows, you will need the User Interface package.

Note: You only have to have change buttons on those spreadsheets with constant values (ss1 and ss2 in the above example). See my note here
Discuss the assignment in CaMILE.