Created
April 14, 2016 06:21
-
-
Save dante-byte/41449d1c54d577b2e68cad161fef9842 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bank.of.atlanta; | |
import java.util.Scanner; | |
public class Bank { | |
public String bankName; | |
public double totalMoneyAtTheBank; | |
public BankAccount[] bankAcctList = new BankAccount[3]; | |
public void addBankAccount(BankAccount bankAcctToAdd, int bankAcctIndex) { | |
System.out.println("we will be adding a bank account"); | |
bankAcctList[bankAcctIndex] = bankAcctToAdd; | |
totalMoneyAtTheBank = totalMoneyAtTheBank + bankAcctToAdd.getBalance(); | |
} | |
public void printInfo() { | |
System.out.println("Name: " + bankName); | |
System.out.println("Total money in this bank: " + totalMoneyAtTheBank); | |
} | |
} | |
//BankAccounts[] allAccounts = new BankAccounts [3]; | |
//allAccounts[0] = ("BusinessCheckings"); | |
//allAccounts[1] = ("BusinessSavings"); | |
//allAccounts[2] = ("PersonalCheckings"); | |
//allAccounts[3] = ("PersonalSavings"); | |
//TotalMoneyAtBank = allAccounts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bank.of.atlanta; | |
import java.util.Scanner; | |
public class BankAccount { | |
public String name; | |
public double balance; | |
public double getBalance() { | |
return balance; | |
} | |
public void printInfo() { | |
System.out.println("====================="); | |
System.out.println("Account name: " + name); | |
System.out.println("Account balance: " + balance); | |
System.out.println("====================="); | |
} | |
public void deposit(double amountToDeposit) { | |
balance = balance + amountToDeposit; | |
} | |
public void withdraw(double amountToWithDraw) { | |
balance = balance - amountToWithDraw; | |
System.out.println("What amount would you like to withdraw"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bank.of.atlanta; | |
import java.util.Scanner; | |
//for (int counter = 0; counter < 4; counter++) {} | |
public class Day9Runner { | |
public static void test() { | |
System.out.println("This account is jsut for testings"); | |
BankAccount testBankAccount = new BankAccount(); | |
testBankAccount.printInfo(); | |
testBankAccount.deposit(10.00); | |
System.out.println(testBankAccount.getBalance()); | |
Bank testBank = new Bank(); | |
testBank.printInfo(); | |
testBank.addBankAccount(testBankAccount, 0); | |
testBank.printInfo(); | |
BankAccount anotherTestAccount = new BankAccount(); | |
anotherTestAccount.deposit(100.00); | |
testBank.addBankAccount(anotherTestAccount, 1); | |
testBank.printInfo(); | |
} | |
public static void openBank() throws Exception { | |
//public static void clearScreen(); | |
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor(); | |
Scanner lineScanner = new Scanner(System.in); | |
System.out.println("May I have your name pleae"); | |
String userName = lineScanner.nextLine(); | |
System.out.println("I've located your account "+ userName); | |
System.out.println("Please enter your password"); | |
String passWord = lineScanner.nextLine(); | |
for (int counter = 0; counter < 2; counter++) { | |
System.out.println("=========================="); | |
System.out.println("Please Wait "); | |
System.out.println(" "); | |
System.out.println(" "); | |
System.out.println("=========================="); | |
Thread.sleep(1000); | |
clearScreen(); | |
System.out.println("============================"); | |
System.out.println("Retreving Account "); | |
System.out.println("Account "); | |
System.out.println("Information "); | |
System.out.println("============================"); | |
Thread.sleep(1000); | |
clearScreen(); | |
System.out.println("============================ "); | |
System.out.println(" "); | |
System.out.println("ONE MOMENT PLEASE "); | |
System.out.println(" "); | |
System.out.println("============================"); | |
Thread.sleep(1000); | |
clearScreen(); | |
System.out.println("============================="); | |
System.out.println("lOADING ACCOUNT INFORMATIONO "); | |
System.out.println(" "); | |
System.out.println(" "); | |
System.out.println("============================="); | |
Thread.sleep(1000); | |
clearScreen(); | |
} | |
System.out.println("****************************"); | |
System.out.println("PLEASE ENTER "); | |
System.out.println("THE LAST FOUR OF "); | |
System.out.println("SOCIAL SECURITY NUMBER "); | |
System.out.println(" "); | |
System.out.println("XXX -XXX-****"); | |
Scanner lineScannerPin = new Scanner(System.in); | |
String str =lineScannerPin.nextLine(); | |
int pinLength = str.length(); | |
String secretPin = ""; | |
for (int pinCount = 0; pinCount < pinLength; pinCount++) { | |
secretPin = secretPin + "*"; } | |
System.out.println(" SSN "+secretPin); | |
clearScreen(); | |
System.out.println("I've located two accounts press 1 for Busines Checking or 2 for Personal Savings"); | |
System.out.println(" you have 2 options "); | |
System.out.println(" *1* Busines Checking"); | |
System.out.println(" *2* Personal Savings"); | |
String userCommanChoice = lineScanner.nextLine(); | |
System.out.println("The user chose option" + userCommanChoice); | |
boolean userChoseOptionOne = userCommanChoice.equals("1"); | |
boolean userChoseOptionTwo = userCommanChoice.equals("2"); | |
if (userChoseOptionOne) { | |
businessChecking(); | |
} | |
if (userChoseOptionTwo) { | |
personalChecking(); | |
} | |
} | |
public static void clearScreen() throws Exception { | |
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor(); | |
} | |
public static void businessChecking() { | |
Bank businessCheck = new Bank(); | |
BankAccount bC = new BankAccount(); | |
for (int counter = 0; counter < 100; counter++) { | |
System.out.println("Welcome to your BC account would like to "); | |
System.out.println(" 1 Make a deposit "); | |
System.out.println(" 2 Make a withdrawal "); | |
System.out.println(" 3 Print Account information "); | |
System.out.println(" 4 Print Bank information "); | |
System.out.println(" 5 Exit "); | |
Scanner lineScanner = new Scanner(System.in); | |
String userCommanChoice = lineScanner.nextLine(); | |
System.out.println("The user chose option" + userCommanChoice); | |
boolean userChoseOptionOne = userCommanChoice.equals("1"); | |
boolean userChoseOptionTwo = userCommanChoice.equals("2"); | |
boolean userChoseOptionThree = userCommanChoice.equals("3"); | |
boolean userChoseOptionFour = userCommanChoice.equals("4"); | |
boolean userChoseOptionFive = userCommanChoice.equals("5"); | |
if (userChoseOptionOne) { | |
System.out.println(" What amount wouold you like to deposit "); | |
String rawInput = lineScanner.nextLine(); | |
double userDepositAsADouble = Double.parseDouble(rawInput); | |
System.out.println("the amount of your deposit is " + rawInput); | |
bC.deposit(userDepositAsADouble); | |
} | |
if (userChoseOptionTwo) { | |
//System.out.println("What amount would you like to withdraw "); | |
String rawInput = lineScanner.nextLine(); | |
double userWithDrawAsADouble = Double.parseDouble(rawInput); | |
System.out.println(" the amount of your withdrawal is " + rawInput); | |
bC.withdraw(userWithDrawAsADouble); | |
} | |
if (userChoseOptionThree) { | |
System.out.println(" here is your Bank Information "); | |
bC.printInfo(); | |
} | |
if (userChoseOptionFour) { | |
System.out.println("here is your Bank Information"); | |
businessCheck.printInfo(); | |
bC.printInfo(); | |
} | |
if (userChoseOptionFive) { | |
System.out.println("Exit online"); | |
break; | |
} | |
} //4loop | |
} | |
public static void personalChecking() { | |
for (int counter = 0; counter < 4; counter++) { | |
System.out.println("Welcome to your BC account would like to "); | |
System.out.println(" 1 Make a deposit "); | |
System.out.println(" 2 Make a withdrawal "); | |
System.out.println(" 3 Print Account information "); | |
System.out.println(" 4 Print Bank information "); | |
System.out.println(" Exit "); | |
Scanner lineScanner = new Scanner(System.in); | |
String userCommanChoice = lineScanner.nextLine(); | |
System.out.println("The user chose option" + userCommanChoice); | |
} //4loop | |
} | |
public static void main(String[] args) throws Exception { | |
System.out.println("Welcome to Bank of Atlanta"); | |
System.out.println ("Which Bank Account would you like to access today you have to options"); | |
System.out.println("Options 1 Bank of America"); | |
System.out.println("Options 2 Ghetto Brand Banking"); | |
Scanner lineScanner = new Scanner(System.in); | |
String userCommanChoice = lineScanner.nextLine(); | |
System.out.println("The user chose option " + userCommanChoice); | |
boolean userChoseOptionOne = userCommanChoice.equals("1"); | |
boolean userChoseOptionTwo = userCommanChoice.equals("2"); | |
if (userChoseOptionOne) { | |
openBank(); | |
} | |
if (userChoseOptionTwo) { | |
test(); | |
} | |
} | |
} | |
//System.out.println("amount u have is"); | |
//String totalMoneyAtTheBank = lineScanner.nextLine(); may use for options 3 | |
//System.out.println("here is your accoount information " + totalMoneyAtTheBank); | |
//businessCheck.printInfo(totalMoneyAtTheBank); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment