Find a good book on beginning programming.
Type: Posts; User: Norm
Find a good book on beginning programming.
I agree. I think this assignment is past your current knowledge.
Try working on one with only one class and a couple of methods to see how to create objects and call their methods.
Good luck
Then its value starts at -1 before there are any elements in the list.
When there is only one element in the list, then the index to the last element is 0.
Is that how your code uses the top...
That's confusing. Is it a count of the number of items in the list
or is it the index of the last element in the list.
I'm not sure how to count the last element. Wouldn't that count always be...
I don't think you answered my question.
What value is in the top variable?
Is it the index of the last element in the list or is it the count of the number of items in the list?
Or is it the...
What value is in the top variable?
Is it the index of the last element in the list or is it the count of the number of items in the list?
Don't use the for each loop. You have a variable with the number of contacts in the list. Use a normal loop with the value of that variable controlling the number of loops.
Look at this simple program segment. If the array contains null, null is returned by the for each:
String[] list = new String[3]; // create with 3 slots
list[0] = "test"; ...
Please show the FULL output.
try it an see what happens.
You need to design what is to go on each line that you print out.
Then you need to figure out where each piece of data on that line comes from.
Then you can write the code to print out that line...
You need to think about what data you want to print and where that data is located.
What is in the list array?
If you get an object from the list array, what does it contain? How do you get the...
What class is the list variable?
What does that class's to String method return?
In the code you posted, you call the toString method seven times for each index's value.
Your program appears to be in a loop, repeatedly printing out the last entry in the list.
Look at your logic to see why the code in the loop does not move the next item in the list or exit the loop....
You have posted what looks like the definition for the AddressBook class.
What is the "this" you refer to?
Also where is the arraylist? I see an array but no arraylist.
I have no idea what you...
Should it?
where is it looking?
Use = to assign a value to a variable. An assignment returns the value (and type) of the left hand operand.
Use == to compare two operands. It returns a boolean value.
When you get errors you must post the full text of the error messages.
This is interesting. If the list is full you don't allow it to be viewed:
if(addressbook.isFull()){
...
The problem is the code is indented but it's missing the {}s.
ALWAYS code the starting { and the ending } down one line when coding an if statement. Start with this and THEN fill in the code inside...
I'm living in Missouri, a state famous for its mules.
I thought you had your design done and were now ready to code the program.
Look back through the posts to see what you decided to do where and when. Then do that.
Before you do any more coding...
What variable is null? Make sure you give the variable a valid value before you use it.
Ok keep up the good work.
Ok. Have you answered the question you asked in post#145
What happens when the user enters the other options:
D
U
V
S