+ Rearrange the blocks to create a Player class with a private int health instance variable. Implement a getter and a setter that validates health points to remain within 0 and 100.
+
+
+
+
+
+ public class Player {
+ private int health;
+
+
+ public class Player {
+ public int health;
+
+
+
+
+ public int getHealth() {
+ return health;
+ }
+
+
+ public void getHealth() {
+ return health;
+ }
+
+
+
+
+ public void setHealth(int health) {
+ if (health >= 0 && health <= 100) {
+ this.health = health;
+ }
+ }
+
+
+ public void setHealth(int health) {
+ if (health >= 0 && health <= 100) {
+ health = health;
+ }
+ }
+
+
+
+ }
+
+
+
+