Someone asked me this, what will be a good aproach?
Design a model of a spreadsheet (like excel), but don’t be afraid, do it very simple!
We only need a basic class diagram with no more than 5 or 6 classes.
It should have the following features:
- The sheet will only manage numeric data
- There will be two types of cells:
- Cells that contain a fix number
- Cells that contain a formula
- The formulas are very straightforward; just support two types of operations: subtraction and addition of two cells.
Eg:
Cell A + Cell B;
Cell A - Cell B;
- Don't worry about parsing or managing the formulas as text, just suppose that you will have the three parameters separately (the operation and the two referenced cells).
- The spreadsheet will only contain one column.
- Don't worry about the graphic interface or user interactions. JUST DO THE DIAGRAM OF THE BASIC MODEL.
One possible idea is to have an element call SpreadSheet that contains a collection of Cells and the operations to set and get cells values. If you find a better approach, use it!
[edit]The following added to question as OP added it as a comment - OriginalGriff[/edit]
So far i think on adding this classes: SpreadSheet, Column, FormulaCell and NumericCell. I also will add a ICell interface. Is this a good approach? I trying to figure out the methods and properties of each classes, can someone help a newbie? - promotcompany 1 hour ago
[Edit: removed text from code block]
[edit]The following added to question as OP responded as an answer - OriginalGriff[/edit]
I was thinking in adding a Row class and add this for the spreadsheet class
Methods
AddColumn
InsertColumn
RemoveColumn
AddRow
InsertRow
RemoveRow
SelectAllRows()
UnselectAllRows()
Properties
ActiveColumn
ActiveRow
NumberOfColumns
NumberOfRows
ReadOnly
I'm on the right direction?
[edit]Don't add an answer - it only lets you know that it has happened. Edit your question so it is better illustration of what you are thinking, and comment on answers. That way we get an email to say you have done it! Cack-handed? Yes. But under development... :-D [/edit]
CAn someone helps to point me to the right direction, the question said:
The spreadsheet will only contain one column
should i add a column class or not?
I add an image of a posibble solution, is it good?
http://img543.imageshack.us/i/diagram.png/