From 6f195d8b761011db7040615fa4c4028dde4417b4 Mon Sep 17 00:00:00 2001 From: Joel Cavat <jcavat@gmail.com> Date: Wed, 2 Oct 2019 18:11:04 +0200 Subject: [PATCH] Add snipet chpt 4 --- snippet/ch4/Account.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 snippet/ch4/Account.java diff --git a/snippet/ch4/Account.java b/snippet/ch4/Account.java new file mode 100644 index 0000000..f1a0f6f --- /dev/null +++ b/snippet/ch4/Account.java @@ -0,0 +1,21 @@ +public class Account { + + private final String owner; + private double balance; + + public Account(String owner, double balance) { + this.owner = owner; + this.balance = balance; + } + + public Account(String owner) { + this(owner, 0.0); + } + + public String getOwner() { return this.owner; } + public double getBalance() { return this.balance; } + + public void deposite(double amount) { this.balance += amount; } + public void withdraw(double amount) { this.deposite(-amount); } + +} -- GitLab