I am creating a random name generator for a fantasy table top game I play with my friends. Everything is working so for, except for when I go to scan a nextLine() for my description, the program doesn't wait for input, and instead goes back to the start of the while loop. What I want to do, is be able to type in a short sentence about the character they are interacting with, and have it set to the String value Description, later my goal is to print these values out in a text document as I create them for future use. My code for that section looks like as follows. Any help is greatly appreciated.
System.out.println("Male (m) Female (f) Quit (q)");
ui = UserInput.next();
while(!(ui.equals("q"))){
if(ui.equals("m")){
mName = maleNameGenerator(MS, SS, MaleNamesArray, SurnamesArray);
System.out.println(mName);
System.out.print("Location: ");
Location = UserInput.next();
System.out.print("Profession: ");
Profession = UserInput.next();
System.out.print("Description: ");
Description = UserInput.nextLine();
}
else if(ui.equals("f")){
fName = femaleNameGenerator(FS, SS, FemaleNamesArray, SurnamesArray);
System.out.println(fName);
}
else if(!(ui.equals("q"))){
System.out.println("Please input valid choice.");
}
System.out.println("Male (m) Female (f) Quit (q)");
ui = UserInput.next();
ui.toLowerCase();
}
UserInput.close();