Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help

 
Victoria Preston
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me what is wrong with my program pleaseeeee or just a hint
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What should the output be and what is the program doing?
 
Victoria Preston
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Victoria Preston
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21123
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Victoria Preston
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for all your help.....I think I have figured it out
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic