How to create a data structure that represent a Customer??


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: How to create a data structure that represent a Customer??

  1. #1
    Join Date
    May 2006
    Posts
    4

    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

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    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?

  3. #3
    Join Date
    May 2006
    Posts
    4
    I mean a Collection that can hold those all variables that i mentioned.......... plz help.......... if u can

  4. #4
    Join Date
    Mar 2004
    Posts
    635
    I believe he means a Class. Read chapter 1 of any Java book or ask your teacher.

    Code:
    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;
    
    }

  5. #5
    Join Date
    May 2006
    Posts
    4
    Quote Originally Posted by Phaelax
    I believe he means a Class. Read chapter 1 of any Java book or ask your teacher.

    Code:
    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

  6. #6
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    Two dimensional array would do very well, if you are keeping data on a number of Customers - store all values as Strings

  7. #7
    Join Date
    May 2006
    Posts
    4
    PLz provide me code for that................ plzzzzzzzz

  8. #8
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    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:

    Code:
    String [][] customers = new String[20][6];
    customers[0] = {"First Name", "Last Name", "Order Number", 
                                   "Product Purchased", "Date", "Time"};

Similar Threads

  1. create shape and append coomand data report
    By helme_syahiemie in forum VB Classic
    Replies: 1
    Last Post: 01-03-2007, 11:49 AM
  2. Replies: 0
    Last Post: 03-02-2006, 03:29 PM
  3. Replies: 0
    Last Post: 12-27-2005, 05:43 AM
  4. Create MAT data file from C++
    By alvinw in forum C++
    Replies: 1
    Last Post: 10-06-2005, 09:08 PM
  5. Replies: 0
    Last Post: 07-21-2000, 04:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center