Search:

Type: Posts; User: GregBrannon

Search: Search took 0.10 seconds.

  1. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    Encouraging you (and showing you how) to think through solving this yourself.

    Problem statement: It (the second loop) works the first time but when it comes to that point again after looping it...
  2. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    You're being a bit dense. I told you that a nextLine() was required after collecting numeric input because nextInt(), nextDouble(), etc. leave a linefeed in the input buffer. In the case shown,...
  3. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    Because of this:

    paid = scan.nextLine();
    scan.nextLine();

    The nextLine() method will wait until the buffer contains a linefeed. You have two of them in a row, so two <returns> are required.
  4. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    If you're asking for help by this statement, please post your latest code, and, as appropriate, a sample run that shows problems/undesirable behavior, current issues, specific questions, and any...
  5. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    Again, take a breath, read the error, look at the code it is pointing at, and take a moment to think.

    A few thoughts should occur to you: '=' is the assignment operator, '==' is the comparison...
  6. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    You need to think these things through a bit more and thoughtfully TRY things. You're getting frustrated and giving up too early.

    Your current construction is:

    if ( yes )

    if ( no )

    else...
  7. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    if ( thisString.equals( thatString ) )
  8. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    Are you using the comparison operator, '==', instead of the equals() method to compare Strings?
  9. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    Essentially, yes. If you've gotten the desired data, as in:

    double neededData = input.nextDouble();

    you can "flush the buffer" immediately afterwards with

    input.nextLine();

    If there are...
  10. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    Scanning for a specific token, usually a numeric value like int, double, etc., does not capture and clear the linefeed character in the input buffer. If that Scanner statement is followed by one...
  11. Thread: Java Help

    by GregBrannon
    Replies
    26
    Views
    3,351

    [SOLVED] Re: Programming Assignment

    Welcome to the Forum! Please read this topic to learn how to post your code correctly along with other useful info for newcomers.
Results 1 to 11 of 11