Complete Method Actions For Different States

master
Hammy 4 years ago
parent fbe7e2294d
commit 695dafcbe9

@ -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

@ -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 :(");
}
}

@ -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() {

Loading…
Cancel
Save