Results 1 to 4 of 4
Thread: Arrays and methods
- 10-05-2009, 08:06 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 2
- Rep Power
- 0
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
- 10-05-2009, 08:10 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
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.
- 10-05-2009, 09:32 AM #3
Member
- Join Date
- Oct 2009
- Posts
- 2
- Rep Power
- 0
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.
- 10-05-2009, 09:43 AM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
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
-
Trouble with static methods and boolean equals() methods with classes
By dreamingofgreen in forum New To JavaReplies: 8Last Post: 04-16-2012, 11:00 PM -
How to get methods to see variables in other methods
By ejs7597 in forum New To JavaReplies: 4Last Post: 04-03-2009, 06:36 AM -
methods, classes, arrays.. oh my!
By katalyst in forum New To JavaReplies: 30Last Post: 03-30-2009, 12:57 AM -
Arrays & Methods
By TheRocket in forum New To JavaReplies: 1Last Post: 12-10-2008, 07:37 PM -
need help with arrays
By Jman in forum New To JavaReplies: 17Last Post: 07-21-2008, 02:34 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks