Search:

Type: Posts; User: Wonderlandslost

Page 1 of 2 1 2

Search: Search took 0.07 seconds.

  1. Replies
    64
    Views
    5,061

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

    Okay, I reviewed the chapters and figured out the meaning. That means not equal to.
  2. Replies
    64
    Views
    5,061

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

    I do not know that the != operator does. I do know that that will be true when there is an empty spot, or a null spot, in the array.

    I also ran the program, printing out what x was from the...
  3. Replies
    64
    Views
    5,061

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

    So, I tried doing what you said, I had troubles with it, but i was looking at the code once more and it looks as if the findFirstEmpty is only returning -1.

    It'll go through the for loop...
  4. Replies
    64
    Views
    5,061

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

    I was mistaken, thinking that names was something I could use there. I corrected that. I'm now testing in my main method;



    /*
    * Author: Rachel Moss
    * Class: CS 3100
    * Teacher: Dr....
  5. Replies
    64
    Views
    5,061

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

    /*
    * Author: Rachel Moss
    * Class: CS 3100
    * Teacher: Dr. Silverman
    *
    * Compiles:
    * Works:
    */
    package schoolbus; //Check this portion 2/10/12
  6. Replies
    64
    Views
    5,061

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

    Okay, now I'm having some troubles with the test method and my getOn method;


    public String sample(String name)
    {
    name = "Anna";
    names.getOn(name);
    return name;
    ...
  7. Replies
    64
    Views
    5,061

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

    I've tested them. They all work so far. I'm just confused how to get the name in there to set it to null. I thought that using if x>= 0, then following that with names = null; would work. And...
  8. Replies
    64
    Views
    5,061

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

    It was put into the array and then set out so that it could get more information. So, would this one need to return anything at all, since it is merely setting a portion to null once more?

    And...
  9. Replies
    64
    Views
    5,061

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

    I'm not sure to the first question, I'm not sure how to go about doing that. As for why it returns a string, perhaps it doesn't. I've changed it slightly to have it return null, since I am changing...
  10. Replies
    64
    Views
    5,061

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

    getOff is supposed to take the array and find a specific name, it then has to take that and set it back to null, which virtually represents the child getting off of the bus. I think that it is...
  11. Replies
    64
    Views
    5,061

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

    In regards to the getOff function, since it is similar to getOn by way of what it's doing, only reverse, would it be possible to do something like this;


    public String getOff(String name)
    ...
  12. Replies
    64
    Views
    5,061

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

    Okay, I'm not completely sure I'm following, but would it be the fact I have x != -1 instead of x == -1?
  13. Replies
    64
    Views
    5,061

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

    Would it be something along the lines of this;


    int x =findFirstEmpty();
    //Take the empty seat and put the child in it
    if (x != -1)
    {
    //indicates...
  14. Replies
    64
    Views
    5,061

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

    Since I returned the -1 value to indicate that it was a full array. I thought that by stating that the x value I pulled from findFirstEmpty was equal to -1 in the if statement, I could have the...
  15. Replies
    64
    Views
    5,061

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

    So, I wouldn't need a return? Or would I need to return something else, like the original string name instead of the array string names?
    Something like;

    public String getOn(String name)
    ...
  16. Replies
    64
    Views
    5,061

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

    Well, as far as I understand, the program requires us to push string names, such as anna, into the getOn method through the main method. Since I'm assuming that name is going to be the string that...
  17. Replies
    64
    Views
    5,061

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

    The get one method should be returning the names array correct? Or would it just be returning string name?
    When I changed it to just returning the string name, I didn't get any errors

    And okay,...
  18. Replies
    64
    Views
    5,061

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

    Okay, so this is a portion that makes no sense to me. When declaring methods, how do you know when you need to use public void something(); or public something(); or any of the other options? ...
  19. Replies
    64
    Views
    5,061

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

    So it's supposed to call the method, get the index, set the null spot to the string name provided in the main method and return that to the main method in place of null.
    As far as I understand at...
  20. Replies
    64
    Views
    5,061

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

    Well with that, I used the i in the findFirstEmpty, so would have to change it to an x, which is the int I'm using in getOn, right? So then I would have something like

    if (names[x] = null)
    {
    ...
  21. Replies
    64
    Views
    5,061

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

    Right, so

    int x = findFirstEmpty();

    is what it needs then.
    I'm confused how to take that variable and apply it to the array then. How do I use the string array with an integer?
  22. Replies
    64
    Views
    5,061

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

    So, in reference to my own code, it would be something along the lines of;
    name = findFirstEmpty();
    But, what I don't understand is whether or not the variable I need is an int or a String. Since...
  23. Replies
    64
    Views
    5,061

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

    That makes sense, okay. So I moved the return -1; outside of the for loop altogether, which eliminated the error. Now, I also removed the String n; and the n = names[i];, which I think would be...
  24. Replies
    64
    Views
    5,061

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

    Okay, so something like this;


    public int findFirstEmpty()
    {
    /**
    * Function of this method is to scan the array for the first null
    * position
    */
  25. Replies
    64
    Views
    5,061

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

    Alright, I see what you're saying there. I was under the impression that you had to find and place the string into the array in the findFirstEmpty. So, basically what you mean is that I will locate...
Results 1 to 25 of 33
Page 1 of 2 1 2