Search:

Type: Posts; User: Norm

Search: Search took 0.09 seconds.

  1. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    There are tools and techniques for working on program logic.
    The one I learned was flowcharts. Using paper and pencil you draw a diagram that describes the logic for the program. Use a pencil so...
  2. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    That looks like you need to work out some logic before trying to code it.
  3. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    Try this: write an if statement to compare the contents of the String: userInput to the String: "yes" using the equals() method.
  4. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    Ok. Write the code for those three steps, compile it and test it.
  5. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    Is this what should be done next after the user's first input is read:
    compare user's input to the String: "t"
  6. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    Is that an assignment statement, like this:

    other = response; // save response in other

    I assume the user's response to the question will be read and saved in a variable

    then what?
  7. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    What is the one thing the code must do after the user enters the response to the first question? Don't try to do it all at once. One step at a time.
  8. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    Take it one step at a time and test that each step is done correctly
    Ask a question << does the code do this OK?
    read the response << what is read? Add a println to print out what was read so...
  9. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    What are you trying to do?
    If you want to compare String objects for equality use the equals() method.
  10. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    If the variable: input is a String object you need to use one of the String class's methods for comparing Strings or the equals() method for an exact match.
    See the API doc for the String class for...
  11. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    The code in post#9 had the correct method for reading String input from the user. The code in posts #1 and #13 do not. Use the Scanner method from post#9 to read a String.

    After reading the user...
  12. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    There are several compiler errors that need to be fixed before the code will compile and execute for testing.

    How many versions of the source code do you have? The code in post#1 has several...
  13. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    Strange that the message: Enter No of starter:
    was NOT printed before the call to the nextInt() method.

    The posted code has errors when compiled that need to be fixed so the code can be...
  14. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    Please copy the full text of the error message and paste it here.
    What Scanner methods are you using to read the user's input? Read the Scanner class's API doc to get the correct method to use for...
  15. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    How is the program supposed to work? It looks like the user must make the same answer ( a 1) to all of the questions he is asked.
    Some of the questions look like they would require a response of...
  16. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    Please edit your post and wrap your code with


    //<<<<<<<< This before

    <YOUR CODE HERE>

    //<<<<<<<< This after
  17. Thread: Ugent pls help

    by Norm
    Replies
    33
    Views
    1,820

    Re: Ugent pls help

    Please edit your post and wrap your code with


    <YOUR CODE HERE>

    to get highlighting and preserve formatting.
Results 1 to 17 of 17