Skip to content

Commit

Permalink
Fixed cosmetic issues with lessons 11 and 12
Browse files Browse the repository at this point in the history
  • Loading branch information
mafudge-su committed Oct 29, 2015
1 parent 29357c4 commit c86c708
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,32 +57,12 @@ SAMPLE RUN (three invalid attempts)
public class ATM {

public static void main(String[] args) {
//TODO: Write your code here.
System.out.printf("*********************************\n");
System.out.printf("*** Welcome to FudgeBank ATM! ***\n");
System.out.printf("*********************************\n\n");
Scanner input = new Scanner(System.in);
BankAccount myacct = new BankAccount("1234", 500);
int attempts = 0;
boolean success= false;
while(true) {
System.out.print("Enter PIN # ==> ");
String pin = input.nextLine();
attempts++;
if (pin.equals(myacct.Pin())) {
success = true;
break;
}
if (attempts >= 3) {
success = false;
break;
}
}
if (success) {
menu();
} else {
System.out.println("You entered an invalid pin 3 times!");
}
//TODO: Write your code here.

}

public static void menu() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,28 @@ public static void main(String[] args) {
System.out.printf("*********************************\n\n");
Scanner input = new Scanner(System.in);
//TODO: Write your code here.

BankAccount myacct = new BankAccount("1234", 500);
int attempts = 0;
boolean success= false;
while(true) {
System.out.print("Enter PIN # ==> ");
String pin = input.nextLine();
attempts++;
if (pin.equals(myacct.Pin())) {
success = true;
break;
}
if (attempts >= 3) {
success = false;
break;
}
}
if (success) {
menu();
} else {
System.out.println("You entered an invalid pin 3 times!");
}

}

/** main menu of ATM */
Expand Down

0 comments on commit c86c708

Please sign in to comment.