Advertisement
semsem_elazazy

Untitled

May 25th, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.36 KB | None | 0 0
  1. package package1;
  2. import java.util.*;
  3.  
  4.  
  5. import java.io.*;
  6. import java.util.ArrayList;
  7. import java.util.Scanner;
  8. import java.io.*;
  9. public class Main extends Transactions{
  10.  
  11.     public static void main(String[] args) throws IOException  {
  12.         // FileInputStream fis = new FileInputStream("Yasmeen.txt");
  13.        
  14.            int choise1;
  15.            int choise2;
  16.            Scanner in = new Scanner(System.in);
  17.               Account A = new Account ();
  18.               Transactions T = new Transactions();
  19.               ArrayList<CheckAccount> List1= new ArrayList<CheckAccount>();
  20.              
  21.                
  22.                  
  23.                   CheckAccount check1 = new CheckAccount(1,"Yasmeen");
  24.                   CheckAccount check2 = new CheckAccount(2,"Mariam");
  25.                   CheckAccount check3 = new CheckAccount(3,"Zeinab");
  26.                   CheckAccount check4 = new CheckAccount(4,"Yomna");
  27.                   CheckAccount check5 = new CheckAccount(5,"Yasmin");
  28.                  
  29.                
  30.                   List1.add(check1);
  31.                   List1.add(check2);
  32.                   List1.add(check3);
  33.                   List1.add(check4);
  34.                   List1.add(check5);
  35.                  
  36.                  
  37.                   int customerId;
  38.                   System.out.println("Enter Customer ID");
  39.  
  40.                   customerId = in.nextInt();
  41.                  
  42.                   boolean flag = true;
  43.                   while(flag) {
  44.                      
  45.                  System.out.println("Do you want to :");
  46.                  System.out.println("1) Do a Transaction  ");
  47.                  System.out.println("2) Check your Balance ");
  48.                  System.out.println("3) Quit ");
  49.                  choise2 = in.nextInt();
  50.                  if(choise2 == 1)
  51.                  {
  52.                   if (customerId == check1.id || customerId == check2.id || customerId == check3.id || customerId == check4.id || customerId == check5.id )
  53.                   {
  54.                       //if (customerId == 1 )
  55.                          
  56.                      
  57.                       A.setName();
  58.                       A.setAccount_num();
  59.                       A.setBalance();
  60.        
  61.                       System.out.println("If you want to withdraw enter >> 1 ");
  62.                       System.out.println("If you want to deposite enter >> 2 ");
  63.                        choise1 = in.nextInt();
  64.                        T.setAmount();
  65.                        if (choise1 ==1 ) {
  66.                            A.Withdrawal(amount);
  67.                        }
  68.                        else if (choise1 ==2 ) {
  69.                            A.Deposit(amount);
  70.                        }
  71.                        
  72.                        A.DisplayAccountInformation();
  73.                        
  74.                   }
  75.                   else {
  76.                       System.out.println("Invalid ID");
  77.                   }
  78.                  }
  79.                  if(choise2 == 2) {
  80.                     // FileWriter myWriter = new FileWriter("outcome.txt");
  81.  
  82.                     System.out.println("Your Balance is : "+A.getBalance());
  83.                     System.out.println("Your Balance After Applying Annual Interest is : "+A.AnuualInterestRate());
  84.                  }
  85.                  if (choise2 == 3) {
  86.                     System.out.println("Thanks for Using our Bank ");
  87.                     flag = false;
  88.                  }
  89.                  
  90.                  
  91.                    
  92.                  
  93.                  
  94.                    
  95.                   }
  96.                      
  97.                  }
  98.              
  99.        
  100.     }
  101.  
  102.    
  103.    
  104.  
  105.    
  106.  
  107.  
  108.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement