Edited by noel222, 23 February 2012 - 03:25 PM.
5 replies to this topic
#1
Posted 18 February 2012 - 12:34 PM
nevermind I figured it out
|
|
|
#2
Posted 18 February 2012 - 01:00 PM
Quote
I want to set the number of values in an arraylist to a variable
The ArrayList class has a method that will tell you the size/number of values in the ArrayList.
#3
Posted 18 February 2012 - 01:15 PM
nevermind I figured it out
#4
Posted 18 February 2012 - 01:18 PM
Quote
it says the bag is full,
Add some println statements to the code to show the value of bagSpace every time it changes so you will know what the program is doing.
#5
Posted 18 February 2012 - 01:21 PM
My mistake. I meant to say that the message is "can hold more" which can be found in my addingCandyTest() method. I am really just having a lot of trouble with the CantHoldAnyMore() Method. How would I set the bagspace to reflect the amount of candy added to the bad in the addingCandyTest()?
#6
Posted 18 February 2012 - 01:27 PM
Did you look at using the ArrayList method that gives the number of objects it contains?
Start it at 0 and add one to it every time something was added.
Are you sure that is the correct usage of the bagSpace variable?
Why would its value be passed in the constructor?
Quote
How would I set the bagspace to reflect the amount of candy added
Are you sure that is the correct usage of the bagSpace variable?
Why would its value be passed in the constructor?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









