Unable to get one specific input from scanner
I am a newbie. I know that my code is messy. I will be working on adding
the comments and such.
try \\get customer's address
{
System.out.println("\nPlease type in your shipping address.");
System.out.println ("This way you can receive what you have ordered.");
System.out.println ("In this format: Street, City, State, Zipcode\n");
customerAddress = input.nextLine();
}
catch (Exception e)
{
System.out.println("You need to enter in an address.");
}
try \\get customer's telephone number
{
System.out.println("Please enter in your telephone number:\n");
phoneNumber = input.nextLine();
}
catch (Exception e)
{
System.out.println("You need to enter in a phone number.");
}
I am able to get an input from the phoneNumber but the program seems to
skip right over the customerAddress input.
Below is what I get in the command prompt. Notice that I was able to input
data under the telephone number, but did not get the chance to put it in
the address section.
Please type in your shipping address. This way you can receive what you
have ordered. In this format: Street, City, State, Zipcode
Please enter in your telephone number:
123457890
So my question is. Do you happen to see any logic errors that could be
causing it to skip over?
No comments:
Post a Comment