| 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)"
SpreadsheetRow
class.
cell:put: or
cell:).
type:with: can accept any number of spreadsheets in the
array argument.
type:with:cell:with:cell: will always reference exactly
two spreadsheet cells.
Spreadsheet.
The class method type: could always return an instance of another
class. (But you would not be graded down for doing so, as long as your OOA
is reasonable.)
#sum
and #average. (And these would be good topics to address in
the Reuse section of your report!)
DialogView request: to get the value for
the cell. ALL VALUES MUST UPDATE WHEN THE CELL CHANGES!
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.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.