Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

How to create a data structure that represent a Customer?

PLz any help in this question i need code of "How to create a data structure that represent a Customer??" that structure will hold variables First Name, Last Name, Order number, Products that are bought, Date and Time.
PLZZZ help
[238 byte] By [maroofu] at [2007-11-11 8:44:05]
# 1 Re: How to create a data structure that represent a Customer?
When you use the term "data structure", what are you referring to?

Array, vector, list, other "Collection"
or
Struct or Class or other Abstract Data Type?
nspils at 2007-11-11 22:34:35 >
# 2 Re: How to create a data structure that represent a Customer?
I mean a Collection that can hold those all variables that i mentioned........ plz help........ if u can :confused:
maroofu at 2007-11-11 22:35:30 >
# 3 Re: How to create a data structure that represent a Customer?
I believe he means a Class. Read chapter 1 of any Java book or ask your teacher.

public class ClassName
{
//everything inside these curly brackets is the body of the class
//the body is where you create methods (functions) and define variables

//example of declaring a variable
dataType variablename;

String name;

}
Phaelax at 2007-11-11 22:36:28 >
# 4 Re: How to create a data structure that represent a Customer?
I believe he means a Class. Read chapter 1 of any Java book or ask your teacher.

public class ClassName
{
//everything inside these curly brackets is the body of the class
//the body is where you create methods (functions) and define variables

//example of declaring a variable
dataType variablename;

String name;

}

Thnx for help but i dont mean a class........ i want to create a table...... Named Customer....... that have various coloumns named First name, last name, etc......... i want code for that........ so plz if u can help
maroofu at 2007-11-11 22:37:39 >
# 5 Re: How to create a data structure that represent a Customer?
Two dimensional array would do very well, if you are keeping data on a number of Customers - store all values as Strings
nspils at 2007-11-11 22:38:32 >
# 6 Re: How to create a data structure that represent a Customer?
PLz provide me code for that............ plzzzzzzzz
maroofu at 2007-11-11 22:39:31 >
# 7 Re: How to create a data structure that represent a Customer?
Your 2-D array will have the "row" array - in effect, the first column of the array, from 0 to however many customers you have; the second array will have six elements

Here is a suggestion about how to declare and prime the array, for 20 customers:

String [][] customers = new String[20][6];
customers[0] = {"First Name", "Last Name", "Order Number",
"Product Purchased", "Date", "Time"};
nspils at 2007-11-11 22:40:40 >