Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package BankAccount;
- import java.util.Scanner;
- /**
- *
- * @author jdv10707
- */
- public class BankAccount
- {
- public static void main(String[] args)throws Exception
- {
- Scanner input = new Scanner(System.in);
- BankSavings myBankSavings=new BankSavings();
- int mySavings,Withdraw,Deposit;
- int choice;
- System.out.println("The Bank Account");
- System.out.println("----------------------------------------------------");
- System.out.println("[1] Display current Savings");
- System.out.println("[2] Withdraw");
- System.out.println("[3] Deposit");
- System.out.println("[4] Exit");
- System.out.println("----------------------------------------------------");
- System.out.print("Enter Your Savings: ");
- mySavings = Integer.parseInt(input.nextLine());
- myBankSavings.setmySavings(mySavings);
- for(;;)
- {
- System.out.print("Enter Your Choice: ");
- choice = Integer.parseInt(input.nextLine());
- switch(choice)
- {
- case 1:
- System.out.printf("Your current savings: P%d\n\n",myBankSavings.getmySavings());
- break;
- case 2:
- System.out.printf("Enter the amount to withdraw: ");
- Withdraw = Integer.parseInt(input.nextLine());
- mySavings-=Withdraw;
- myBankSavings.setmySavings(mySavings);
- break;
- case 3:
- System.out.printf("Enter the amount to Deposit: ");
- Deposit = Integer.parseInt(input.nextLine());
- mySavings+=Deposit;
- myBankSavings.setmySavings(mySavings);
- break;
- }}
- }
- }
Add Comment
Please, Sign In to add comment