Results 1 to 4 of 4
  1. #1
    namie is offline Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    0

    Default Arrays and methods

    Good Morning

    I can't wrap my head around methods and arrays in java. Please help with the following:

    [*]create a method called addCustomer(). the method must request the user to enter info for a customer and add the customer to the customer list.[*]First an array called customer list must be used throughout the class to store info about a Customer and a member called numberOfCustomers
    eate

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Okay, and what part of that do you need help with? Show what you have so far, and we will give you hints to help you complete it, but we are not going to do it for you.

  3. #3
    namie is offline Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    0

    Default Methods and Arrays

    this is what i have so far for the first part

    public class CustomerManagementSystem
    {
    int numberOfCustomers = 0;
    int[] customerList = new int[numberOfCustomers];

    public static void numberOfCustomers (int[] list)
    {
    for (int index = 0; index < list.length; index++)
    System.out.print(list[index] + "");
    }
    // this is for the first part, the second part regarding creating
    methods is the one i'm struggling with.

    Please help, this assignment is due in 3 hours.

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    And? What do you have concerning this method?

    You already have one method in that class, so "creating methods" is not, seemingly, the problem. Give it a try.

    Also, concerning that method that is already there. What is it suppossed produce (fix that in your mind)? Now, walk through what the code is actually doing. Is it doing what it is suppossed to do? Somehow, I don't think so. Is the method suppossed to be static? Is it suppossed to have a list passed to it? Somehow, I assume, it is not suppossed to have either of those, but rather, should simply be returning (or printing) the "numberOfCustomers" field.

Similar Threads

  1. Replies: 8
    Last Post: 04-16-2012, 11:00 PM
  2. Replies: 4
    Last Post: 04-03-2009, 06:36 AM
  3. methods, classes, arrays.. oh my!
    By katalyst in forum New To Java
    Replies: 30
    Last Post: 03-30-2009, 12:57 AM
  4. Arrays & Methods
    By TheRocket in forum New To Java
    Replies: 1
    Last Post: 12-10-2008, 07:37 PM
  5. need help with arrays
    By Jman in forum New To Java
    Replies: 17
    Last Post: 07-21-2008, 02:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •