summaryrefslogtreecommitdiff
path: root/java/05-simple-objects/Account.java
blob: 42ccec7cd6d0ed90b7f02b2e59667686b7258f1b (plain)
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
public class Account {
	
	/* Declaring fields  - represent state */
	
	int accountNumber;
	double balance;
	
	
	/* Declaring methods - represent operations */
	
	public void withdraw(double amount) {
		if (balance >= amount) {
			balance = balance - amount;
		}
	}

	public void deposit(double amount) {
		balance += amount;
	}
	
	public double getBalance() {
		return balance;
	}
	
}