Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looping to the start?
#7
It seems that XL's code assumes a two-step process:

a. Get user's input - Z: End program; anything else: Load program.
b. Get user's input - Z: End program; Any other letter: Treat as employee's initial.

The bare minimum you need is just step b for this problem.

> "Hey yo, good day. Say, what do you want?"
> Input A [from range A, B, C, ..., Z].
> "Okay okay, hold on, Andrew, was it? Done. What do you want now?"
> Input B [from range A, B, C, ..., Z].
> "Hmmm.. Barbara from HR? Got it. What do you want now?"
> Input Z [from range A, B, C, ..., Z].
> "Aight, see ya later.

I'd suggest using a boolean exit flag, something like:

Code:
boolean done = false;
while(done != true) {
    // do stuff because not done
    if(user_input.equals("Z")) {
        done = true; // set exit flag
    }
}
Reply


Messages In This Thread
Looping to the start? - by kimicatdemon - 2012-05-02, 01:49 AM
Looping to the start? - by XTOTHEL - 2012-05-02, 01:54 AM
Looping to the start? - by Kalovale - 2012-05-02, 02:30 AM
Looping to the start? - by kimicatdemon - 2012-05-02, 02:42 AM
Looping to the start? - by FenixR - 2012-05-02, 02:50 AM
Looping to the start? - by kimicatdemon - 2012-05-02, 02:53 AM
Looping to the start? - by Kalovale - 2012-05-02, 03:06 AM
Looping to the start? - by kimicatdemon - 2012-05-03, 03:54 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)