-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainApp.java
More file actions
63 lines (49 loc) · 2.1 KB
/
Copy pathMainApp.java
File metadata and controls
63 lines (49 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package Homework_ATM_FinalProject;
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
public class MainApp {
// account number = 00452195
// password = 4519
public static void main(String[] args) {
HashMap<String, String> BankCustomerCredentials = Service.getAllBankCustomerCredentials();
List<BankCustomer> listNew = Service.getAllBankCustomers();
// System.out.println(listNew);
Scanner s = new Scanner(System.in);
System.out.println("Enter account number: ");
String accountNum = s.nextLine();
if (BankCustomerCredentials.containsKey(accountNum)) {
System.out.println("Enter password: ");
String password = s.nextLine();
if (BankCustomerCredentials.get(accountNum).equals(password)) {
System.out.println("You have successfully signed in! ");
// Recognizing and printing the details of the BankCustomer with the Account
// Number and Password from the Scanner
System.out.println("\nBank Customer Details:");
for (BankCustomer b : listNew) {
if (b.getAccountNumber().contentEquals(accountNum)) {
//System.out.println(b);
System.out.println("\nBank Account Number:" + b.getAccountNumber() + "\nName: "
+ b.getFirstName() + "\nLast Name: " + b.getLastName() + "\nDay of Birth: "
+ b.getDayOfBirth() + "\nEmail: " + b.getEmail() + "\nPhone Number: " + b.getPhone()
+ "\nBank Customer Balance is: " + b.getBalance());
System.out.println();
double balance = b.getBalance();
// System.out.println(balance);
// creating object from class ATM_Transaction
ATM_Transaction obj = new ATM_Transaction();
obj.balance = balance; // take the value of variable balance from Main method amd Class to set it to the balance variable in the ATM_Transaction Class
obj.transaction();
}
// System.out.println(b.getBalance());
// balance = b.getBalance;
// Starting to execute transaction methof for balance, Deposit Funds, Withdraw
// funds...
}
} else {
System.out.println("Incorrect username or password ");
}
}
}
}