/*
* Lukas Turner
* Bank
* Page 188
* 4-8-2015
*/
import java.util.Scanner;
import java.text.NumberFormat;
public class Bank{
public static void main(String[]args){
System.out.print("\f");
Account munozAccount = new Account(250, "Maria", "Munoz","110 Glades Road", "Mytown", "FL", "33445");
Account formanAccount = new Account(400, "George", "Forman", "2550 Raid Street", "Moscow", "RU", "45853");
Account putinAccount = new Account(21, "Vladimir", "Putin", "666 Georgetown Street", "Moscow", "RU", "66642");
Account lukasAccount = new Account(50001, "Lukas", "Turner", "1717 Heritage Avenue", "Bismarck", "ND", "58501");
Account underwoodAccount = new Account(50000, "Francis", "Underwood", "6565 Woodworth Street", "Washington", "Distruct of Columbia", "20500");
Account cyrusAccount = new Account(420000, "Miley", "Cyrus", "2500 Nathan Avenue", "Los Angeles", "CA", "25004");
Account bachmanAccount = new Account(54, "Michelle", "Bachman", "5800 Hick Lane", "Kentucky", "Kentucky", "66000");
Account palinAccount = new Account(9850, "Sarah", "Palin", "9696 Doggie Lane", "Fairbanks", "AL", "88866");
Account cruzAccount = new Account(22, "Ted", "Cruz", "5555 Street Street", "Teaparty", "TX", "123456");
Account hamadaAccount = new Account(5042, "Tadashi", "Hamada", "4862 San Street", "Sanfransokyo", "JP","25864");
Account tempAccount = new Account(0, "", "", "", "", "", "");
String change = "";
String street = "";
String city = "";
String state = "";
String zip = "";
Scanner input = new Scanner(System.in);
Scanner choice = new Scanner(System.in);
double data;
int menuchoice = 0;
int accountchoice = 0;
double cashflow = 0;
double cashholdings = 535620;
NumberFormat money = NumberFormat.getCurrencyInstance();
System.out.println("1. Maria Munoz");
System.out.println("2. George Forman");
System.out.println("3. Vladimir Putin");
System.out.println("4. Lukas Turner");
System.out.println("5. Francis Underwood");
System.out.println("6. Miley Cyrus");
System.out.println("7. Michelle Bachman");
System.out.println("8. Sarah Palin");
System.out.println("9. Ted Cruz");
System.out.println("10. Tadashi Hamada");
System.out.println("11. Close bank");
System.out.print("Enter account choice: ");
accountchoice=input.nextInt();
//Print account info
switch(accountchoice){
case 1:
tempAccount = munozAccount;
break;
case 2:
tempAccount = formanAccount;
break;
case 3:
tempAccount = putinAccount;
break;
case 4:
tempAccount = lukasAccount;
break;
case 5:
tempAccount = underwoodAccount;
break;
case 6:
tempAccount = cyrusAccount;
break;
case 7:
tempAccount = bachmanAccount;
break;
case 8:
tempAccount = palinAccount;
break;
case 9:
tempAccount = cruzAccount;
break;
case 10:
tempAccount = hamadaAccount;
break;
}
System.out.println("1. Deposit");
System.out.println("2. Withdrawal");
System.out.println("3. Change Address");
System.out.println("4. Print balance");
System.out.print("Enter choice: ");
menuchoice = input.nextInt();
switch(menuchoice){
case 1:
System.out.print("\n");
System.out.print("Enter Deposit ammount: ");
data = input.nextDouble();
tempAccount.deposit(data);
System.out.print("Balance is: " + money.format(tempAccount.getBalance()));
System.out.println();
System.out.println();
cashflow=data + cashflow;
break;
case 2:
System.out.print("Enter Withdrawal ammount: ");
data = input.nextDouble();
tempAccount.withdrawal(data);
System.out.print("Balance is: " + money.format(tempAccount.getBalance()));
System.out.println();
System.out.println();
if(data<tempAccount.getBalance()){
cashflow=data + cashflow;
}
break;
case 3:
System.out.print("Change address Y or N: ");
change = choice.nextLine();
if(change.equalsIgnoreCase("Y")){
System.out.print("Enter Street: ");
street = choice.nextLine();
System.out.print("Enter City: ");
city = choice.nextLine();
System.out.print("Enter State: ");
state = choice.nextLine();
System.out.print("Enter ZIP: ");
zip = choice.nextLine();
//change address
tempAccount.changeAddress(street,city,state,zip);
}
break;
case 4:
System.out.print("Balance is: " + money.format(tempAccount.getBalance()));
break;
}
//deposit
//Withdrawal
//add bank total
cashholdings = cashflow + cashholdings;
System.out.println();
//print account info
System.out.println("End of Transaction");
if(accountchoice==11){
System.out.println("Total cash flow for the day: " + money.format(cashflow));
System.out.println("Total Cash in the bank: " + money.format(cashholdings));
System.out.println("Bank closed: Good bye");
}
}
}
Well here is the code that I have been working on for class for like 3 days... Everything works with the other two methods and such but the program is supposed to loop (Yess I know there is no loop atm) so you can add in another user after done in one like a real bank then close the bank when you enter 11. The problem is when I enter 11 it goes to the menu again then closes after you choose a thing to do. Then when i had the loop it would just loop the menu choosing and not the whole choice for which person to pick? Any help? Thanks in advance.