-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBank.java
More file actions
56 lines (42 loc) · 1.36 KB
/
Copy pathBank.java
File metadata and controls
56 lines (42 loc) · 1.36 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
package application;
import java.util.Locale;
import java.util.Scanner;
import entities.Account;
public class Bank {
public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner sc = new Scanner (System.in);
Account account;
System.out.print("Enter account number: ");
int number = sc.nextInt();
System.out.print("Enter account holder: ");
sc.nextLine();
String holder = sc.next();
System.out.print("Is there deposit initial (y/n): ");
char response = sc.next().charAt(0);
if (response == 'y') {
System.out.print("Is initial deposit value: ");
double initialDesposit = sc.nextDouble();
account = new Account (number,holder, initialDesposit);
}
else {
account = new Account (number,holder);
}
System.out.println();
System.out.println("Account Data: ");
System.out.println(account);
System.out.println();
System.out.print("Enter a deposit value: ");
double depositValue = sc.nextDouble();
account.deposit(depositValue);
System.out.println("Upadate data: ");
System.out.println(account);
System.out.println();
System.out.print("Enter a withdraw value: ");
double withdrawValue = sc.nextDouble();
account.withdraw(withdrawValue);
System.out.println("Upadate data: ");
System.out.println(account);
sc.close();
}
}