summaryrefslogtreecommitdiff
path: root/oop/01-data-abstraction/Account.java
blob: 03a9e9c04db2f27d4c6babf6bf3a15a6239c5b28 (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
26
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;
	}
	
}