Step

Define the SpreadSheetViewContainer class

Project: P2-Spreadsheet (Salman)

Parent: Build the Spreadsheet, FormulaLibrary, and SpreadSheetViewContainer classes.

Description

Define the SpreadSheetViewContainer class

Strategy

Expected Outcome: You should now be able to run the test code in the System Workspace.

| 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)"

Generic form of this step: How to build a GUI using the C+N library

Representations of this project

Discussion on this project

Discussion on this project from previous students

Concepts related to this step: