diff --git a/Personal/src/bank/assessment/states/LoggedInState.java b/Personal/src/bank/assessment/states/LoggedInState.java index afad5bb..1d39df6 100644 --- a/Personal/src/bank/assessment/states/LoggedInState.java +++ b/Personal/src/bank/assessment/states/LoggedInState.java @@ -19,7 +19,7 @@ public class LoggedInState implements BankAccountStates { @Override public void createAccount(Person person) { - System.out.println("This Account Is Already Registered With Us. Please Log In!"); + System.out.println("This Account Is Already Registered With Us. You Are Already Logged In!"); } @Override @@ -29,7 +29,8 @@ public class LoggedInState implements BankAccountStates { @Override public void logOut() { - // Log out! + System.out.println("You Are Now Logged Out!"); + bankAccount.changeBankAccountState(LoggedOutState.getInstance(bankAccount)); } @Override diff --git a/Personal/src/bank/assessment/states/LoggedOutState.java b/Personal/src/bank/assessment/states/LoggedOutState.java index ddcd3c8..f359677 100644 --- a/Personal/src/bank/assessment/states/LoggedOutState.java +++ b/Personal/src/bank/assessment/states/LoggedOutState.java @@ -1,7 +1,6 @@ package bank.assessment.states; import bank.assessment.BankAccount; -import bank.assessment.BasicAccount; import bank.assessment.Console; import bank.assessment.Person; @@ -41,12 +40,12 @@ public class LoggedOutState implements BankAccountStates { @Override public void logOut() { - System.out.println("You Have Already Logged Out! Please Log in!"); + System.out.println("You Have Already Logged Out!"); } @Override public void deposit() { - + System.out.println("Sorry, Please Log In First Before Trying Deposit Cash!"); } @Override @@ -57,16 +56,12 @@ public class LoggedOutState implements BankAccountStates { @Override public void viewDetails() { - + System.out.println("There Are No Account Details To View, Please Log In!"); } @Override public void deleteAccount() { - bankAccount = new BasicAccount(); + bankAccount.changeBankAccountState(NotCreatedState.getInstance(bankAccount)); System.out.println("Account Deleted! We're Sad To See You Go :("); - - // Same as? - // bankAccount = new BasicAccount(); - // System.out.println("Account Deleted! We're Sad To See You Go :("); } } diff --git a/Personal/src/bank/assessment/states/NotCreatedState.java b/Personal/src/bank/assessment/states/NotCreatedState.java index 355121a..329b91d 100644 --- a/Personal/src/bank/assessment/states/NotCreatedState.java +++ b/Personal/src/bank/assessment/states/NotCreatedState.java @@ -50,9 +50,7 @@ public class NotCreatedState implements BankAccountStates { } @Override - public void logIn() { - System.out.println("Sorry, Our Systems Couldn't Find Your Details. Please Try Again or Register!"); - } + public void logIn() { System.out.println("Sorry, Our Systems Couldn't Find Your Details. Please Try Again or Register!"); } @Override public void logOut() { @@ -71,9 +69,7 @@ public class NotCreatedState implements BankAccountStates { } @Override - public void viewDetails() { - System.out.println("There Are No Account Details To View, Please Log In or Register!"); - } + public void viewDetails() { System.out.println("There Are No Account Details To View, Please Log In or Register!"); } @Override public void deleteAccount() {