Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Bank {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int choice1;
- String choice2;
- while(true)
- {
- System.out.println("What type of account you want to create?");
- System.out.println("1: Saving Account");
- System.out.println("2: Current Account");
- System.out.println("3: Student Account");
- Scanner sc= new Scanner(System.in);
- choice1 = sc.nextInt();
- if(choice1==1)
- {
- String name;
- int ab,mb,tn;
- System.out.println("Name:");
- name=sc.next();
- System.out.println("Account Balance:");
- ab=sc.nextInt();
- System.out.println("Minimum Balance:")
- mb=sc.nextInt();
- System.out.println("Trade Number:");
- tn=sc.nextInt();
- SavingAccount sa = new SavingAccount(name,ab,mb,tn);
- System.out.println("Enter 1 or d to deposit");
- System.out.println("Enter 2 to withdraw");
- System.out.println("Enter 3 to show balance");
- System.out.println("Enter 0 to exit");
- choice2=sc.next();
- if(choice2=="1"||choice2=="d")
- {
- int balance;
- System.out.println("Enter the amount you want to deposit:");
- balance=sc.nextInt();
- sa.deposit(balance);
- }
- if(choice2=="2")
- {
- int draw;
- System.out.println("Enter the amout you want to withdraw");
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment