-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestBankAccount.java
More file actions
52 lines (41 loc) · 1.59 KB
/
TestBankAccount.java
File metadata and controls
52 lines (41 loc) · 1.59 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
import java.util.Scanner;
/**
* TestBankAccount
*/
public class TestBankAccount {
static Scanner input = new Scanner(System.in);
public static void main(String[] args) {
BankAccount bankAccount1 = new BankAccount(),
bankAccount2 = new BankAccount(),
bankAccount3 = new BankAccount(),
bankAccount4 = new BankAccount();
bankAccount1 = getData();
bankAccount2 = getData();
bankAccount3 = getData();
input.close();
showValues(bankAccount1);
showValues(bankAccount2);
showValues(bankAccount3);
showValues(bankAccount4);
}
public static BankAccount getData(){
BankAccount bAccount = new BankAccount();
System.out.print("Enter the account's number: ");
bAccount.setAccountNumber(input.nextLine());
System.out.print("Set the account's name: ");
bAccount.setName(input.nextLine());
System.out.print("Set the account's balance: ");
bAccount.setBalance(input.nextDouble());
input.nextLine();
System.out.print("\n");
return bAccount;
}
public static void showValues(BankAccount acc) {
System.out.println("----------------\nAccount Number: "+ acc.getAccountNumber());
System.out.println("Account Name: "+ acc.getName());
System.out.println("Account Balance: "+ acc.getBalance());
acc.deductMonthlyFee();
acc.explainAccountPolicy();
System.out.println("Account Balance: "+ acc.getBalance()+"\n----------------\n");
}
}