Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bin/Spreadsheet.class
Binary file not shown.
Binary file modified bin/SpreadsheetTest.class
Binary file not shown.
40 changes: 38 additions & 2 deletions src/Spreadsheet.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
import java.util.Arrays;

public class Spreadsheet {
Object [ ] [ ] sheet = new Object [ 4 ] [ 5 ] ;


public class IntCell {
public int Integer;

public IntCell (int a){
a = Integer;

}
}

public class StringCell{
public String Stringy;

public StringCell (String a){
a = Stringy;
}
}


public String get(String cell) {
// to be implemented
return null;
return cell;
}

public void set(String cell, String value) {
// to be implemented
//A1 must be interpreted as [1] [A] = [1] [1]

char columnchar = cell.charAt(0);

char columnletter [] ={'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'L', 'M' };
//int column [] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

int column = Arrays.asList(columnletter).indexOf(columnchar);


if (value.contains("'")){
StringCell s = new StringCell(value);
}else{
int a = Integer.parseInt(value);
IntCell i = new IntCell(a);
}
}

public String evaluate(String cell) {
Expand Down
10 changes: 10 additions & 0 deletions tests/SpreadsheetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,15 @@ public void test() {
fail("Not yet implemented");

}
@Test
public void SetGetIntCell() {

Spreadsheet spread = new Spreadsheet();
spread.set("A1", "5");
spread.get(cell);

assertEquals("return value incorrect", "5", cell);

}

}