Search:

Type: Posts; User: Norm

Page 1 of 2 1 2

Search: Search took 0.17 seconds.

  1. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    If you don't understand what the != operator does or how to use it, how do you expect to be able to write a program?

    My suggestion is that you go back a couple of chapters and start again. There...
  2. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    You need to show how you are testing the method. What does the array contain when the method is called?
    What response do you expect when you call the method?


    if (names[i] != null)
    Do you know...
  3. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    Where is the test code for the findFirstEmpty() method?
    I suggested that you test it with three different array contents.

    For example: Manually create an array: names = new String[]{"aname"};...
  4. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    names is a String array. It does not have any methods named getOn()

    What is the statement: names.getOn
    supposed to do? It does not make any sense.

    Where did you test the previous methods that...
  5. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    Can you explain what the problem is?
    Post all of the code and its output and add comments explaining what is wrong.
  6. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    I listed two steps that needed to be done in this method.
    Have you gotten the first one to work?
    1) find a specific name,

    Write and test a method that just does that one step.
  7. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    You should test each method as you write it to be sure it is working before going to the next method.
    Have you tested the previous method(s) that you wrote?
    If not, you need to write a testing...
  8. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    You have already written a search loop in the findFirstEntry method so you know how to write a loop and compare the contents of the array to a desired value. The loop in getOff will be very...
  9. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    Where in the code you posted for getOff() does it look for the name in the array?
    Why does the code for the getOff() method return a String?

    The code you posted and the description you just...
  10. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    In arrays, 0 is the index to the first element in the array.

    What is the method getOff supposed to do? What does it do with the String: name that is passed to it?
    What value is it supposed to...
  11. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    Yes that would a better way to test it.
  12. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    Look at your test again.
  13. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    How would you code that?
    What you coded was something different.
  14. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    Can you Explain what you are trying to do here.
  15. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    If you want to return an array, you need to change the definition of the method to show that.
    BUT there is no need to return the array if the array is defined outside of the method where it is...
  16. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    Fill in the ...s
    It depends on what the design of the program requires.

    BTW You need to do something if findFirstEmpty returns -1
  17. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    The first is for a method that does not return anything.
    The second is a constructor for the something class.

    What method?
    Leave off the []s.
  18. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    That sounds reasonable, except that the code you posted earlier for getOn() showed that it did not return anything(void)
  19. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    The name of the variable you use for the index into an array is not important. i or x or theNameHere any are ok.

    Again you need to decide what the getOn() method is supposed to do BEFORE you...
  20. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    You get at the contents of an array by using an index. I see in your code that you have used indexes into arrays before.
    Can you explain what the problem is?

    Two examples:


    names[i]...
  21. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    The variable must be the same type as what the method returns.
  22. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    When a method returns a value, when you call it you should assign that returned value to a variable:
    variable = aMethodThatReturnsValue();
  23. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    Look at the code and think about these two cases:
    If the first element in the array is not null, what will the code do?
    What if none of the elements in the array are null and the code exits the...
  24. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    What if there are no null entries? What will the code do then?
    The compiler sees that case and sees that you do not have a return statement for it.
    Decide what the code should do in a NO-FIND and...
  25. Replies
    64
    Views
    5,061

    [SOLVED] Re: Stuck and can't get past it!

    You're mixing the finding of the empty slot with putting a value in that slot.
    Those should be done in separate places. Keep the method simple: find and return the index of the empty slot.
    the...
Results 1 to 25 of 31
Page 1 of 2 1 2