Skip to content

Instantly share code, notes, and snippets.

@dante-byte
Created April 13, 2016 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dante-byte/145ec27d8a735b94df42c117781fcc93 to your computer and use it in GitHub Desktop.
Save dante-byte/145ec27d8a735b94df42c117781fcc93 to your computer and use it in GitHub Desktop.
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;
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() {
System.out.println("What amount would you like to withdraw");
}
}
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() {
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();
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("Busines Checking");
System.out.println("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 businessChecking() {
Bank businessCheck = new Bank();
BankAccount bC = new BankAccount();
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(" 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 userDepositAsADouble = lineScanner.nextLine();
System.out.println("the amount you deposited is " + userDepositAsADouble);
//System.out.println(bc.totalMoneyAtTheBank);
}
if (userChoseOptionTwo) {
System.out.println("What amount would you like to withdraw");
String userWithDrawAsADouble = lineScanner.nextLine();
System.out.println("the amount you withdrew is " + userWithDrawAsADouble);
}
if (userChoseOptionThree) {
String totalMoneyAtTheBank = lineScanner.nextLine();
System.out.println("here is your accoount information " + totalMoneyAtTheBank);
}
if (userChoseOptionFour) {
System.out.println("here is your Bank Information");
}
if (userChoseOptionFive) {
System.out.println("Exit online banking");
}
} //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) {
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();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment