Search:

Type: Posts; User: maple1100

Search: Search took 0.16 seconds.

  1. Replies
    17
    Views
    1,632

    Re: Java IndexOutOfBound

    Sorry. I mess up with putting the println you gave me earlier in the wrong method. Here is the correct one.
    "add() mC= []
    add() mC= [SKU 1234-0: 500]
    add() mC= [SKU 1234-0: 500, SKU 1234-1: 25]...
  2. Replies
    17
    Views
    1,632

    Re: Java IndexOutOfBound

    "add() mC= [SKU 1234-0: 500, SKU 1234-1: 25, SKU 1234-2: 7720]
    add() mC= [SKU 1234-0: 500, SKU 1234-1: 25, SKU 1234-2: 7720]
    add() mC= [SKU 1234-0: 500, SKU 1234-1: 25, SKU 1234-2: 7720]
    add() mC=...
  3. Replies
    17
    Views
    1,632

    Re: Java IndexOutOfBound

    Thanks for the help yesterday, Norm. I managed to change the code to print out 3 different song for Bin A but it is using the first song from Bin A for Bin B instead of another random song. I believe...
  4. Replies
    17
    Views
    1,632

    Re: Java IndexOutOfBound

    Sorry to keep bothering you ,Norm. But after modifying my code with what I know, I still can't get it to print 3 song for Bin A instead of 1 song. May I get some more hints? Thanks

    The direction I...
  5. Replies
    17
    Views
    1,632

    Re: Java IndexOutOfBound

    I tested it and the catalog.get() is working fine but it seem the warehouse arraylist only have the size of 2 for some reason. Could you check in the Bin class if I wrote the methods to add to...
  6. Replies
    17
    Views
    1,632

    Re: Java IndexOutOfBound

    I edited the code a little and here is the new code


    import java.util.*;
    public class Media
    {
    public static ArrayList<MusicMedia> MakeMusicCatalog(int size)
    {
    ...
  7. Replies
    17
    Views
    1,632

    Re: Java IndexOutOfBound

    "b.getContents().get(i)" is causing the error because only 4 ArrayList is created but the for loop is calling for < catalog.size() which is 10.
  8. Replies
    17
    Views
    1,632

    Re: Java IndexOutOfBound

    That what I was thinking too. Since the size of warehouse is only 4, the maximum index would be 3. I figured the error is at "for(Bin b : warehouse)" since warehouse is 4 and it would result in the...
  9. Replies
    17
    Views
    1,632

    Java IndexOutOfBound

    Could someone help me with fixing this indexoutofbound error? The error is occuring at
    "s += catalog.get(i).toString() + "," + catalog.get(i).getSKU() + ": " + b.getContents().get(i)+ "\n" ;"
    ...
Results 1 to 9 of 9