I have to create a program which constructs trig tables; these tables are created using the "-" and "|" keys, and the number of columns is a dynamic value based on user input at the start of the program. Each cell in the program must contain the value of a trig function, and the table will be populated with these values over a range of numbers. I don't know how to create this table. And I don't understand how I'll be able to create a cell reference so that I can input the data. Anyone?
I would create two objects here. A cell object and a table object so you can fill your table w/ your 'cells'. So 3 operating classes here. your main program that creates the tableObject, your tableObject class defining the table, and the CellObject class with cell definitions. I'll throw you up a class framework when i get some extra time tonight. If you need any help after that feel free to ask
This is just a framing and only a partial to give you some inspiration. If you need more elaboration just holla. the List is to hold all the Cells Simple tableObject class public class tableObject { private int _numberOfColumns; private int _numberOfRows; private List<CellObject> _cellList; private ColumnHeaders _myHeaders; private enum ColumnHeaders {Degree, Radians, Sin, Cos, Tan, Csc, Sec, Cot} private StringBuilder _sbTableString; public tableObject(int p_intNumColumns, int p_intRangeStart, int p_intRangeEnd) { _sbTableString = new StringBuilder(); _numberOfColumns = p_intNumColumns; _numberOfRows = (p_intRangeStart - p_intRangeEnd) + 1; //+1 because the last number in the range is included _cellList = new List<CellObject>(); CreateTableCells(p_intNumColumns, p_intRangeStart, p_intRangeEnd); } private void CreateTableCells(int p_intNumColumns, int p_intRangeStart, int p_intRangeEnd) { //CreateHeader(); } public void CreateHeader() { } public float getCellValue(int p_intColumn, int p_intRow) { //Will need logic here to return appropriate cell, this is just an example so picking the first one in the list and returning CellObject _myCell = (CellObject)_cellList[0]; return _myCell.getCellValue(); } public string GetTable() { if (_cellList.Count > 0) { } return "Table contains no cells"; } } ----------------------------- cellObject class class CellObject { private float _cellValue; private string _cellColumnName; public CellObject(float p_longCellData, string p_strName) { _cellColumnName = p_strName; _cellValue = p_longCellData; } public float getCellValue() { return _cellValue; } } ------------ main program int intNumberOfColumns = 3; int intRangeStart = 10; int intRangeEnd = 24; tableObject myTable = new tableObject(intNumberOfColumns, intRangeStart, intRangeEnd); textBox1.Text = myTable.GetTable();