Search:

Type: Posts; User: maple1100

Page 1 of 6 1 2 3 4

Search: Search took 0.11 seconds.

  1. Replies
    3
    Views
    1,191

    Java arraylist question

    This is a question on my homework, can anyone help me understand what it saying ? Thanks
    "Suppose that you have an ArrayList and that it contains String objects. Which declaration of the ArrayList...
  2. Replies
    2
    Views
    1,118

    [SOLVED] Re: Java constructors

    Solved.
  3. Replies
    2
    Views
    1,118

    [SOLVED] Java constructors

    Solved.
  4. Replies
    4
    Views
    2,611

    [SOLVED] Re: Java sequential search.

    Found it. Thanks!
  5. Replies
    4
    Views
    2,611

    [SOLVED] Re: Java sequential search.

    I .add(found) onto the arrayList, is there a way to check if an ArrayList contains elements? Since the "found" only get added when the String match, if there no string match then there be nothing...
  6. Replies
    4
    Views
    2,611

    [SOLVED] Java sequential search.

    I'm working on sequential search and this is my code to search a String. The problem I have is that once the array is found, it stop. I was wondering what if there are more than one occurrence of...
  7. Replies
    2
    Views
    1,317

    Re: Java selection sort

    Thanks for the hints on the value of max.
    Here is my new code and it working, but I don't understand why the inner loop need to have an index of max which = i for it to work.


    public static...
  8. Replies
    2
    Views
    1,317

    Java selection sort

    I'm currently doing selection sort and this is my method to sort a array of string into alphabet order. I interpret the code line by line into words and test it by hand it seem to make sense but when...
  9. Replies
    0
    Views
    960

    Insertion sorts

    I'm current doing insertion sorts with ArrayList and I'm getting java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at replace.get(insertindex).setTitle(next); . I understand there is nothing at...
  10. Replies
    10
    Views
    1,582

    Re: Java abstract/implements

    Jaguar: Quantity = 2, Total cost = 2100000.0
    Neon: Quantity = 3, Total cost = 52375.32
    Jigsaw: Quantity = 1, Total cost = 149.18
    RAM: Quantity = 1, Total cost = 35700.0
    CircularSaw: Quantity = 2,...
  11. Replies
    10
    Views
    1,582

    Re: Java abstract/implements

    Is there another way to print out the results? That the only wait I could of think, as it complete the inner loop, it print.
  12. Replies
    10
    Views
    1,582

    Re: Java abstract/implements

    Oh, I don't mean to code it for me. I updated the code with the loop going through and keeping the quantity above, but it printing all the items. IE if there 2 item A, it would print item A two time...
  13. Replies
    10
    Views
    1,582

    Re: Java abstract/implements

    Chris, thanks for the reply! Can you give me help on my updated code above? Thanks
  14. Replies
    10
    Views
    1,582

    Java abstract/implements

    takeInventory suppose to keep count of the items that passes through and print their quantity. The result I'm getting is
    "guar: Quantity = 2, Total cost = 1110000.0
    Neon: Quantity = 3, Total cost...
  15. Thread: Java printf

    by maple1100
    Replies
    5
    Views
    1,513

    Re: Java printf

    So do I change it to %5.2d? I still get the error on that.
  16. Thread: Java printf

    by maple1100
    Replies
    5
    Views
    1,513

    Re: Java printf

    It not allowing me to print at all, it giving me the error at that line. I think what causing is I don't have a conversion format inside the printf for "(c.get(x).getVotes() / total ))" I do have...
  17. Thread: Java printf

    by maple1100
    Replies
    5
    Views
    1,513

    Java printf

    This is part of my code. I'm getting "illegalformatconversion" at the printf statement. How can I change the code so that the third thing it print is the votes / total votes? Thanks


    public...
  18. Replies
    9
    Views
    1,244

    Re: Java abstracts

    The second indexes should be 1 more than the first, am I correct?

    --- Update ---

    It work when I set i = x+1. Is this the correct way? Thanks
  19. Replies
    9
    Views
    1,244

    Re: Java abstracts

    I understand the starting at another index part but let say I put i=1 instead of 0 , it might not compare itself to thing at index 0 but at index 1 and so on it will compare itself.
  20. Replies
    9
    Views
    1,244

    Re: Java abstracts

    This is the nested loop that I have but it also compare the objects to itself since x and i have the same value at some point. How can I avoid the objects inside the list comparing itself? Thanks

    ...
  21. Replies
    9
    Views
    1,244

    Re: Java abstracts

    Would the List that I created with the objects being added fine or do I need to create a different array? Thanks
  22. Replies
    9
    Views
    1,244

    Java abstracts

    For the code belong, I'm trying to compare all the objects with each other and print if they're the same, is there any efficient methods in doing so beside me creating like 20 if else statement and...
  23. Replies
    6
    Views
    1,173

    Re: Java abstract

    I forgot about calling the method, I thought it would call itself for some reason. Thanks you so much!
  24. Replies
    6
    Views
    1,173

    Re: Java abstract

    It print out nothing. Since I "setType("Math"); " won't it print out "Math"?
  25. Replies
    6
    Views
    1,173

    Re: Java abstract

    public class testHomework
    {
    public static void main(String[]args)
    {
    MyMath math = new MyMath();


    System.out.println(math.toString());

    }
Results 1 to 25 of 130
Page 1 of 6 1 2 3 4