Beispiel #1
1
 void sortbyAccount() {
   List<Accounts> ac = new ArrayList<Accounts>(accounts.values());
   ac.sort(Accounts.AccountComparator);
   for (Accounts a : ac) {
     a.dispaly();
   }
 }
Beispiel #2
0
 void searchAccountByBalance() {
   System.out.println(
       "\nEnter your Choice\n1.Exact Balance\n2.More than Balance\n3.Less than Balance\n4.Balance Range");
   Scanner in = new Scanner(System.in);
   int amount;
   int choice = in.nextInt();
   boolean flag = true;
   switch (choice) {
     case 1:
       System.out.println("Enter the Amount to be search");
       amount = in.nextInt();
       for (Accounts a : accounts.values()) {
         if (a.balance == amount) {
           a.dispaly();
           flag = false;
         }
       }
       if (flag) System.out.println("No Data Found");
       break;
     case 2:
       System.out.println("Enter the Amount to be search for equal and more");
       amount = in.nextInt();
       for (Accounts a : accounts.values()) {
         if (a.balance >= amount) {
           a.dispaly();
           flag = false;
         }
       }
       if (flag) System.out.println("No Data Found");
       break;
     case 3:
       System.out.println("Enter the Amount to be search for equal and less");
       amount = in.nextInt();
       for (Accounts a : accounts.values()) {
         if (a.balance <= amount) {
           a.dispaly();
           flag = false;
         }
       }
       if (flag) System.out.println("No Data Found");
       break;
     case 4:
       System.out.println("Enter the Amount range\nMinimum:");
       amount = in.nextInt();
       System.out.println("Maximum:");
       int max = in.nextInt();
       for (Accounts a : accounts.values()) {
         if (a.balance >= amount && a.balance <= max) {
           a.dispaly();
           flag = false;
         }
       }
       if (flag) System.out.println("No Data Found");
       break;
     default:
       System.out.println("Worn Input");
   }
 }
Beispiel #3
0
 void sortAccountByCustomer() {
   List<Customer> cl = new ArrayList<Customer>(customers.values());
   cl.sort(Customer.CustomerComparatorByName);
   for (Customer c : cl) {
     System.out.println("Customer Name: " + c.CustomerName);
     Accounts a = accounts.get(c.AccountId);
     a.dispaly();
   }
 }