diff --git a/Lesson-11/Activities/ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java b/Lesson-11/Activities/ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java index 546fa80..9abad90 100644 --- a/Lesson-11/Activities/ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java +++ b/Lesson-11/Activities/ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java @@ -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() { diff --git a/Lesson-11/SOLUTIONS/Solution-ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java b/Lesson-11/SOLUTIONS/Solution-ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java index 96ecc58..a215a79 100644 --- a/Lesson-11/SOLUTIONS/Solution-ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java +++ b/Lesson-11/SOLUTIONS/Solution-ChallengeActivity1-ATMPin/src/fudgebanking/ATM.java @@ -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 */ diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/build.xml b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/build.xml similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/build.xml rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/build.xml diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/manifest.mf b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/manifest.mf similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/manifest.mf rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/manifest.mf diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/build-impl.xml b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/build-impl.xml similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/build-impl.xml rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/build-impl.xml diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/genfiles.properties b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/genfiles.properties similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/genfiles.properties rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/genfiles.properties diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/project.properties b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/project.properties similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/project.properties rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/project.properties diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/project.xml b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/project.xml similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/nbproject/project.xml rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/nbproject/project.xml diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java b/Lesson-12/Activities/ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java rename to Lesson-12/Activities/ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/build.xml b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/build.xml similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/build.xml rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/build.xml diff --git a/Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/manifest.mf b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/manifest.mf similarity index 100% rename from Lesson-12/SOLUTIONS/ChallengeActivity1-MinAndMax/manifest.mf rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/manifest.mf diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/build-impl.xml b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/build-impl.xml similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/build-impl.xml rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/build-impl.xml diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/genfiles.properties b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/genfiles.properties similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/genfiles.properties rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/genfiles.properties diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/project.properties b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/project.properties similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/project.properties rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/project.properties diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/project.xml b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/project.xml similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/nbproject/project.xml rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/nbproject/project.xml diff --git a/Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java b/Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java similarity index 100% rename from Lesson-12/Activities/Solution-ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java rename to Lesson-12/SOLUTIONS/Solution-ChallengeActivity1-MinAndMax/src/minandmax/MinAndMax.java