implementiing a table with headers, rows, and columns.
Posted on 2004-03-25
I have to write a source code for a spare parts company. There are only 3 "Parts" that i need to specify
Code Part Price Quantity On Hand Reorder Level
are the headers
I have inital values available.
What I am trying to work out is:
Is there some way to initialise the Parts with the values without having to define and initialise 3 times.
eg: having to repeat the variables for each part
source code i have so far is
//DEFINE AND INITIALISE PART 1 OBJECTS AND VARIABLES
int Code1 = 1; //CODE PART 1
string Part1 = "Rear Axle"; //PART REAR AXLE
double Price1 = 128.00; //PRICE PART 1
int QuantityOnHand1 = 5; //QUANTITY ON HAND PART 1
int reorderLevel1 = 2; //REORDER LEVEL PART 1
//DEFINE AND INITIALISE PART 2 OBJECTS AND VARIABLES
int Code2 = 2; //CODE PART 2
string Part2 = "Bearings"; //PART BEARINGS
double Price2 = 25.50; //PRICE PART 2
int QuantityOnHand2 = 20; //QUANTITY ON HAND PART 2
int reorderLevel2 = 10; //REORDER LEVEL PART 2
//DEFINE AND INITIALISE PART 3 OBJECTS AND VARIABLES
int Code3 = 3; //CODE PART 3
string Part3 = "Brake Pads"; //PART BRAKE PADS
double Price3 = 30.00; //PRICE PART 3
int QuantityOnHand3 = 12; //QUANTITY ON HAND PART 3
int reorderLevel3 = 6; //REORDER LEVEL PART 3
and can you tell me how I make this information appear as a table?
This is my first go at a code that is like this.