Arrays and methods
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
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.
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.
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.