Created
April 14, 2016 02:06
-
-
Save dante-byte/eb1bea02bde704701bdd066d8ecc7598 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 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) { | |
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() { | |
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("****** FOR ACCESS PLEASE ENTER THE LAST FOUR OF YOUR SOCIAL SECURITY NUMBER ******"); | |
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); | |
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 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); | |
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("the amount you withdrew is " + userWithDrawAsADouble); | |
bC.withdraw(userWithDrawAsADouble); | |
} | |
if (userChoseOptionThree) { | |
//System.out.println("amount u have is"); | |
//String totalMoneyAtTheBank = lineScanner.nextLine(); | |
//System.out.println("here is your accoount information " + totalMoneyAtTheBank); | |
//businessCheck.printInfo(totalMoneyAtTheBank); | |
} | |
if (userChoseOptionFour) { | |
System.out.println("here is your Bank Information"); | |
bC.printInfo(); | |
} | |
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