next
public String next(Pattern pattern)
Returns the next token if it matches the specified pattern. This method may block while waiting for input to scan, even if a previous invocation of hasNext(Pattern) returned true. If the match is successful, the scanner advances past the input that matched the pattern.
Parameters:
pattern - the pattern to scan for
Returns:
the next token
public String nextLine()
Advances this scanner past the current line and returns the input that was skipped. This method returns the rest of the current line, excluding any line separator at the end. The position is set to the beginning of the next line.
Since this method continues to search through the input looking for a line separator, it may buffer all of the input searching for the line to skip if no line separators are present.
Returns:
the line that was skipped
Here is the program that you started with and a few changes. First I always just import the whole java.util or any of the others. That way when I am working I do not have to go back and add another sector of the class. I also set the decision at the bottom as well as the request for a decision. I also cleared the variable “fullname” after it's use, at the bottom. I changed some of the variables it is best to be descriptive so, it is easy to read. Oh! I also setup the decision from ZZZZ to Y/N so that next() would work. As you can see from above next() returns a token; one character in this case. As you can read from above the nextLine() searches till reads a line separator so there needs to be a line separator added to your variable or else you will only be able to use the name input first time around. I could not find a way around this with the limitations you have on your assignment. There are lots of ways of doing it a lot easier but not within the scope of your assignment.
Take care and remember there is no such thing as Luck just hard work and good thoughts.
I hope this helps you. Make your logic flow from one section to the other. In my other post I to had some logic mistakes.