aspose file tools*
The moose likes Beginning Java and the fly likes Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help" Watch "Help" New topic
Author

Help

Victoria Preston
Ranch Hand

Joined: Feb 03, 2006
Posts: 106
Can anyone tell me what is wrong with my program pleaseeeee or just a hint
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
What should the output be and what is the program doing?
Victoria Preston
Ranch Hand

Joined: Feb 03, 2006
Posts: 106
it should let me add as many employess to a list as I want...this program should also let me remove employees when i need to and then let me print out the list with all the information for each employee
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
I think what Keith is asking is what is it not doing that it should be doing. What does your test program look like and where is its output doing something unexpected?
[ February 05, 2006: Message edited by: Garrett Rowe ]

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Victoria Preston
Ranch Hand

Joined: Feb 03, 2006
Posts: 106
oh sorry.....its not letting me add more than two employee to the list even though I have a method to make a different array that is bigger....
also whenever I ask it if the list is empty or not it always says it empty even if its not.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18120
    
  39

I don't know the cause of you particular problem -- but I did find 2 errors.

1. Your second contructor does not work. You never set the capacity, nummber of elements, or initialze the list, like you did in your default constructor.

2. You remove method is wrong. You merely zapped out the element to remove, and lowered the size. This will only work for the last element -- deleting any other element just gives you a null element, and a lost last element.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Victoria Preston
Ranch Hand

Joined: Feb 03, 2006
Posts: 106
the one thing i need to get it to do is to allow me to add more than two employees to the list
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
One problem I see is in your constructor.

You use this line.



This is backwards. capacity is your instance variable and cap is your parameter.
Victoria Preston
Ranch Hand

Joined: Feb 03, 2006
Posts: 106
thanks for all your help.....I think I have figured it out
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help
 
Similar Threads
error
Set Capacity of array problem
CompareTo() method
h:selectOneMenu - setting the correct value
Iterator Pattern