hi danpost
I am building a banking system for my take home assignment. from the beginning, i am trying to implement a part where the user would enter their pin numbers. the program stated that it have i can either use the while or do while. i choose the latter. the while.
the first part is asking the user to enter their 4 digit pin number. if the user mis-step and enter the wrong pin number, the user is given another chance to re-enter their pin.
i put it in an if else construct and also use a do while in order to give the user another chance to re-enter their pin and for some reason it is not letting the user re-enter their pin, it just hit the first statement in the if construct and it just goes straight to ask for the user name . can u tell me where and why in the codes why it is not allowing the user to re-enter the pin when they have entered the wrong pin number. here is the codes i have used so far.
PS. I am not finished building the system. here is the codes
while(i<2)
{
System.out.println("please enter your 4 digit pin number");
pin = userin.nextInt();
if(pin == 1234)
{
System.out.println("you can begin your transaction");
numtries++;
}
else if(pin != 1234)
{
System.out.println("incorrect pin number, try again");
}
do
{
if(pin != 1234)
{
System.out.println("please re-enter your pin");
}
}while(pin == 1234);
System.out.println("please enter the customer first name");
String customer_firstname = userin.next();
System.out.println("please enter the customer last name");
String customer_lastname = userin.next();
System.out.println("please enter customer ID");
String customer_ID = userin.next();
System.out.println("please enter menu type");
System.out.println(" please enter type code: S");
option = userin.next().charAt(0);
System.out.println("please enter initial account balance");
initialacct_bal = userin.nextDouble();

