diff --git a/source/ch6_definingclasses.ptx b/source/ch6_definingclasses.ptx
index 4375608..4a270ce 100644
--- a/source/ch6_definingclasses.ptx
+++ b/source/ch6_definingclasses.ptx
@@ -423,6 +423,74 @@ public Fraction(Integer num, Integer den) {
+
+
+
+
+ Rearrange the blocks to construct a fully encapsulated BankAccount class. The class should feature:
+
+ - A private double balance instance variable.
+ - A public getter method getBalance() that returns the balance.
+ - A public setter method setBalance(double balance) that updates the balance only if the value is non-negative ($ \ge 0 $).
+
+
+
+
+
+
+ public class BankAccount {
+ private double balance;
+
+
+ public class BankAccount {
+ public double balance;
+
+
+
+
+
+ public double getBalance() {
+ return balance;
+ }
+
+
+ public void getBalance() {
+ return balance;
+ }
+
+
+
+
+
+ public void setBalance(double balance) {
+
+
+ public double setBalance(double balance) {
+
+
+
+
+
+ if (balance >= 0.0) {
+ this.balance = balance;
+ }
+ }
+
+
+ if (balance >= 0.0) {
+ balance = balance;
+ }
+ }
+
+
+
+
+ }
+
+
+
+
+