-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccountCreation.java
More file actions
48 lines (41 loc) · 1.03 KB
/
AccountCreation.java
File metadata and controls
48 lines (41 loc) · 1.03 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
import javax.swing.JOptionPane;
public class AccountCreation {
private String firstname = "";
private String lastname = "";
private String username = "";
private double balance = 0;
private String output = "";
AccountCreation(){
//Default Constructor
}
AccountCreation(String firstname, String lastname, String username){
this.firstname = firstname;
this.lastname = lastname;
this.username = username;
this.balance = 100;
}
//Method getter
public String getFirstName() {
return this.firstname;
}
public String getLastName() {
return this.lastname;
}
public String getUsername() {
return this.username;
}
public double getBalance() {
return this.balance;
}
public void deposit(double amount) {
output+="Deposited: "+amount+"\n";
this.balance+= amount;
}
public void withdraw(double amount) {
output+="Withdrawed: "+amount+"\n";
this.balance -= amount;
}
public void history() {
JOptionPane.showMessageDialog(null, "History\n"+output);
}
}