From 371312fdf31262deb01fe68b6eb644ed7a18f9d1 Mon Sep 17 00:00:00 2001
From: Adam Roesner <67762559+roesnera@users.noreply.github.com>
Date: Tue, 22 Nov 2022 12:03:48 -0500
Subject: [PATCH 1/6] Update README.md
---
README.md | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index bc79c46..0cb0f78 100644
--- a/README.md
+++ b/README.md
@@ -12,14 +12,12 @@ constructor with the name. Create a setter method
opponent); an no attributes.
To the Warrior class. Add a decHealth method with a single
parameter int amt. Set the health value to Math.max(0, health –
-amt); which will keep the health attribute from going negative. Then
-call the opponent’s decHealth method. The getName, getHealth,
+amt); which will keep the health attribute from going negative. The getHealth
and setHealth from Person class will be used.
To the Warrior class add an attack method that takes a Warrior
opponent parameter. If this warrior’s health is positive and the
opponent’s health is positive and this warrior’s weapon is not null,
-print this warrior’s name is attacking the opponent’s name. Finally,
- print the opponent’s name and health.
+print this warrior’s name is attacking the opponent’s name. Then, call the strike method of the weapon attribute of your warrior class. Finally, print the opponent’s name and health.
Use the provided Weapons and Main classes to validate your Warrior
and Weapon classes.
Output should be:
From b1d90a12dc5f4960d8b9c373b4c599d4636391d2 Mon Sep 17 00:00:00 2001
From: roesnera
Date: Mon, 15 May 2023 11:51:49 -0400
Subject: [PATCH 2/6] changes jdk to 17
---
.idea/misc.xml | 5 +++-
.idea/vcs.xml | 6 +++++
.../example/polymorphism_exercise/Main.class | Bin 0 -> 1081 bytes
.../polymorphism_exercise/Person.class | Bin 0 -> 713 bytes
.../example/polymorphism_exercise/Sword.class | Bin 0 -> 1250 bytes
.../example/polymorphism_exercise/Wand.class | Bin 0 -> 1251 bytes
.../polymorphism_exercise/Warrior.class | Bin 0 -> 1830 bytes
.../polymorphism_exercise/Weapon.class | Bin 0 -> 377 bytes
.../example/polymorphism_exercise/Whip.class | Bin 0 -> 1248 bytes
.../example/polymorphism_exercise/Person.java | 23 ++++++++++++++++++
.../polymorphism_exercise/Warrior.java | 23 ++++++++++++++++++
.../example/polymorphism_exercise/Weapon.java | 5 ++++
12 files changed, 61 insertions(+), 1 deletion(-)
create mode 100644 .idea/vcs.xml
create mode 100644 out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Main.class
create mode 100644 out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Person.class
create mode 100644 out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Sword.class
create mode 100644 out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Wand.class
create mode 100644 out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Warrior.class
create mode 100644 out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Weapon.class
create mode 100644 out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Whip.class
create mode 100644 src/com/example/polymorphism_exercise/Person.java
create mode 100644 src/com/example/polymorphism_exercise/Warrior.java
create mode 100644 src/com/example/polymorphism_exercise/Weapon.java
diff --git a/.idea/misc.xml b/.idea/misc.xml
index d15472f..29cba1f 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,9 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Main.class b/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Main.class
new file mode 100644
index 0000000000000000000000000000000000000000..5f3060c7cc6e235586e15083021cf2f3d9b0614d
GIT binary patch
literal 1081
zcma)6$!;1!5Pi+!fnj1W#&%ZQWWj7^vN(sxk#op$!pVUM$I2mUa0`#a%%EYMknhPC
zgw9wtEwJ;|M~d~z!9FBh#_tuVIheXf!u}sBJIBPdiJ}{
zh3bX^E6*Lz36BKgbglUC=jHcKPiTGh1LAJYac^0;jXNBZ3`5!dEYOGqI-k!BbthW0
z=gz>ywqDlVND0T%@k|so%OW0FDCzyidOnBz(mzuI*{0*Ex0h~51@C32PfNb(cV)jV
z14rK%#ze@~3PkBjLmsmJhzl2}MH&8L4on(y^E_PE5ZEk#yy}h6FM}T0tY6_4FkAj*
z&{c07-Ar1uY3PT>{)>F(`WJ`L51n$4H=C#6nXFDAeo%>_OsU;Ev_fgk15ib6=I0b?
z(aGN#5$E}O3ga}No*>hlX{*$ZYg6P-C&-VnUY}x%>J6&3`WQFsH46H-Y25v1T!NR7
zX3-=}0u_+L4)0ZD$koCDR`CK^yu#Xy-0qyff}Dv%)Ui)`1w2B7T8z0i9xez!<6SqF
hnW9MSdt=;R!s`D4Fwx{!wCp>>LXT+|ctRP&!Cyh>0bBq8
literal 0
HcmV?d00001
diff --git a/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Person.class b/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Person.class
new file mode 100644
index 0000000000000000000000000000000000000000..0e5d1246f840d144b7d3c7c00d6fcd603121f611
GIT binary patch
literal 713
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
literal 0
HcmV?d00001
diff --git a/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Weapon.class b/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Weapon.class
new file mode 100644
index 0000000000000000000000000000000000000000..5dca60ac5a1333504935675803bc1c26652ab293
GIT binary patch
literal 377
zcma)2K~BRk5S&fY2GT;IKj4=3P(Prk7bH$mIe@|uIbj7ZNgO#TD$nAC#DNF!D8!ob
zfch|_o%OEA^ZoPr1z?3~f&gKRXp8}dgtLu))vD6Xle#H3T=sAJ00wYGYzt!tl6S3mHMU1>U2_pDpn5TYyl$b?B|8eVVfg58}iDp97HEp?S^
zXMFuHM!jqy%(FuuSc<)_cjiSlF49BBv~$L~_rUe?j;Jh=5Z}M3rC#1DyW?2$fwx
literal 0
HcmV?d00001
diff --git a/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Whip.class b/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Whip.class
new file mode 100644
index 0000000000000000000000000000000000000000..c2718e3675f90d6bdd6cb586f2b44cc5cc288b4b
GIT binary patch
literal 1248
zcma)6T~8B16g@+cE$d3Lv><*UDqu^M_4}*H15F4d6*VR0!3Q&JCv@oU&SrN?=s)pq
z=mRD^_yhb=#ye~iYG_RNVRq)uy=U*a=VX8XIr{}*1Mh8&A!A|O!4*s}lspx<;)Dm0
zFWgA^y+FlLTPDF*aUx<*Cc@npJW?UU#JUWn-eAa-%FRh+F=@eea1{>2^btSiuFu0m
zx6w%mut7YAW=&-j}*fyF~L)Ck!j4%audGY}~-Sg_{m;;Wop}
z5GvGAWQh4RpyDvprs2Ba;4T&!CR@VW7TniuhVjx)xoP1(bu$9}wv4ExrdmWiSC^sK
z?FI)T-s1;8Me=p!algr9Y0mxNxF#J*;reLsRZ=*iA$ACFZKR@9l4`lhkW~?RM1-Vx
zWt8vrOBw8j>c*bfl7@zpS}j>KgCkjlQrJ+0y%!?!_c`iUv%HV<3ANS5kKb-GdYvM&ZA{}k@^A~7WW%Rv6e
zgCpVT>Y%gw5H;@m4XH&ni&tg{A&(;JdXdo(cEV7^HJ>MmNG!Z%SiZz@SnC!@!G-^)
zlEf)bEaD#h2+U(v`W1lT0qtCRGZR_;3HJT`dWlwZ4dk&*tCJ>R1rO;&21A)vQ~a60
z3|#RCtjZ~_onZzz#azWY#hnYVDP$T@{
literal 0
HcmV?d00001
diff --git a/src/com/example/polymorphism_exercise/Person.java b/src/com/example/polymorphism_exercise/Person.java
new file mode 100644
index 0000000..9a0505a
--- /dev/null
+++ b/src/com/example/polymorphism_exercise/Person.java
@@ -0,0 +1,23 @@
+package com.example.polymorphism_exercise;
+
+public class Person {
+ private final String name;
+ private int health;
+
+ public Person(String name) {
+ this.name = name;
+ health = 100;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getHealth() {
+ return health;
+ }
+
+ protected void setHealth(int health) {
+ this.health = health;
+ }
+}
diff --git a/src/com/example/polymorphism_exercise/Warrior.java b/src/com/example/polymorphism_exercise/Warrior.java
new file mode 100644
index 0000000..685d06f
--- /dev/null
+++ b/src/com/example/polymorphism_exercise/Warrior.java
@@ -0,0 +1,23 @@
+package com.example.polymorphism_exercise;
+
+public class Warrior extends Person {
+ private Weapon weapon;
+
+ public Warrior(String name) {
+ super(name);
+ }
+
+ public void setWeapon(Weapon weapon) { this.weapon = weapon; }
+
+ public void decHealth(int amt) {
+ setHealth(Math.max(0, getHealth() - amt));
+ }
+
+ public void attack(Warrior opponent) {
+ if (0 < getHealth() && 0 < opponent.getHealth() && weapon != null) {
+ System.out.println(getName() + " is attacking " + opponent.getName());
+ weapon.strike(opponent);
+ System.out.println(opponent.getName() + " health = " + opponent.getHealth());
+ }
+ }
+}
diff --git a/src/com/example/polymorphism_exercise/Weapon.java b/src/com/example/polymorphism_exercise/Weapon.java
new file mode 100644
index 0000000..c5568a8
--- /dev/null
+++ b/src/com/example/polymorphism_exercise/Weapon.java
@@ -0,0 +1,5 @@
+package com.example.polymorphism_exercise;
+
+public abstract class Weapon {
+ abstract void strike(Warrior opponent);
+}
\ No newline at end of file
From 3967a5f40d33833895ff0dcd301d750fa05ab89c Mon Sep 17 00:00:00 2001
From: roesnera
Date: Mon, 15 May 2023 11:52:28 -0400
Subject: [PATCH 3/6] adds gitignore for out dir
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
create mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..89f9ac0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+out/
From dddca525065d8a3c41722ef7f456f425a37f804b Mon Sep 17 00:00:00 2001
From: roesnera
Date: Mon, 15 May 2023 11:56:17 -0400
Subject: [PATCH 4/6] resets exercise
---
.../example/polymorphism_exercise/Main.class | Bin 1081 -> 1081 bytes
.../polymorphism_exercise/Person.class | Bin 713 -> 713 bytes
.../example/polymorphism_exercise/Sword.class | Bin 1250 -> 1250 bytes
.../example/polymorphism_exercise/Wand.class | Bin 1251 -> 1251 bytes
.../polymorphism_exercise/Warrior.class | Bin 1830 -> 1830 bytes
.../polymorphism_exercise/Weapon.class | Bin 377 -> 377 bytes
.../example/polymorphism_exercise/Whip.class | Bin 1248 -> 1248 bytes
.../example/polymorphism_exercise/Person.java | 23 ------------------
.../polymorphism_exercise/Warrior.java | 23 ------------------
.../example/polymorphism_exercise/Weapon.java | 5 ----
10 files changed, 51 deletions(-)
delete mode 100644 src/com/example/polymorphism_exercise/Person.java
delete mode 100644 src/com/example/polymorphism_exercise/Warrior.java
delete mode 100644 src/com/example/polymorphism_exercise/Weapon.java
diff --git a/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Main.class b/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Main.class
index 5f3060c7cc6e235586e15083021cf2f3d9b0614d..8baee8425e28bc8ba60c422827d2624fd6a7c3ae 100644
GIT binary patch
delta 17
ZcmdnVv6F-2)W2Q(7#J9AH*y%V002Kw1@-^{
delta 17
ZcmdnVv6F-2)W2Q(7#JArHgXuU002K#1@`~|
diff --git a/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Person.class b/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Person.class
index 0e5d1246f840d144b7d3c7c00d6fcd603121f611..dbf17e6d0de8e4014fd55abe55069eaf245f6ad2 100644
GIT binary patch
delta 17
ZcmX@fdXkmn)W2Q(7#J9AH*y?g0sul32A%)_
delta 17
ZcmX@fdXkmn)W2Q(7#JArHgX(f0sul82A==`
diff --git a/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Sword.class b/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Sword.class
index 23d17fd472b59f9ae3ca52c7a161ef62e63ecc02..6629f96ac76a154d66149ec94e64740730fe9392 100644
GIT binary patch
delta 17
ZcmaFF`G}L_)W2Q(7#J9AH*(x!0RTnd2J-*_
delta 17
ZcmaFF`G}L_)W2Q(7#JArHgeoz0RTni2J`>`
diff --git a/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Wand.class b/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Wand.class
index c0ad6d990c8f8a9d1e3ad1f2ffc4a272a69dd875..7010a36baa3fa1b848a4c83d0e517609a66cdaa7 100644
GIT binary patch
delta 17
ZcmaFN`IwXA)W2Q(7#J9AH*(x&0RTn<2KE2|
delta 17
ZcmaFN`IwXA)W2Q(7#JArHgeo%0RTn^2KN8}
diff --git a/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Warrior.class b/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Warrior.class
index b3e36cb55eb23f46e50222fce5926fda05473ba6..0796460bc7394e5df927f1ae04c8c629d2a15ec3 100644
GIT binary patch
delta 17
ZcmZ3+w~UYD)W2Q(7#J9AH*(0a0{}gN1)W2Q(7#J9AH*yp*0su!D2B!c3
delta 17
Zcmey#^plC>)W2Q(7#JArHgXg)0su!I2B-i4
diff --git a/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Whip.class b/out/production/JavaIntro4Debrief/com/example/polymorphism_exercise/Whip.class
index c2718e3675f90d6bdd6cb586f2b44cc5cc288b4b..a0a76d8e00c5622033796d66f438d6e8b5f781e6 100644
GIT binary patch
delta 17
ZcmaFB`GAw-)W2Q(7#J9AH*(xy0RTmu2JHX<
delta 17
ZcmaFB`GAw-)W2Q(7#JArHgeox0RTmz2JQd=
diff --git a/src/com/example/polymorphism_exercise/Person.java b/src/com/example/polymorphism_exercise/Person.java
deleted file mode 100644
index 9a0505a..0000000
--- a/src/com/example/polymorphism_exercise/Person.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.example.polymorphism_exercise;
-
-public class Person {
- private final String name;
- private int health;
-
- public Person(String name) {
- this.name = name;
- health = 100;
- }
-
- public String getName() {
- return name;
- }
-
- public int getHealth() {
- return health;
- }
-
- protected void setHealth(int health) {
- this.health = health;
- }
-}
diff --git a/src/com/example/polymorphism_exercise/Warrior.java b/src/com/example/polymorphism_exercise/Warrior.java
deleted file mode 100644
index 685d06f..0000000
--- a/src/com/example/polymorphism_exercise/Warrior.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.example.polymorphism_exercise;
-
-public class Warrior extends Person {
- private Weapon weapon;
-
- public Warrior(String name) {
- super(name);
- }
-
- public void setWeapon(Weapon weapon) { this.weapon = weapon; }
-
- public void decHealth(int amt) {
- setHealth(Math.max(0, getHealth() - amt));
- }
-
- public void attack(Warrior opponent) {
- if (0 < getHealth() && 0 < opponent.getHealth() && weapon != null) {
- System.out.println(getName() + " is attacking " + opponent.getName());
- weapon.strike(opponent);
- System.out.println(opponent.getName() + " health = " + opponent.getHealth());
- }
- }
-}
diff --git a/src/com/example/polymorphism_exercise/Weapon.java b/src/com/example/polymorphism_exercise/Weapon.java
deleted file mode 100644
index c5568a8..0000000
--- a/src/com/example/polymorphism_exercise/Weapon.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.example.polymorphism_exercise;
-
-public abstract class Weapon {
- abstract void strike(Warrior opponent);
-}
\ No newline at end of file
From b6932e54a25ff26897e91be4bca41bf57b107803 Mon Sep 17 00:00:00 2001
From: roesnera
Date: Mon, 15 May 2023 12:00:15 -0400
Subject: [PATCH 5/6] reworks to include interface, abstract class
---
README.md | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 0cb0f78..936d8ed 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
Polymorphism Exercise
-
Create a Person class with attributes String name and int health.
+
Create an abstract Person class with attributes String name and int health.
Create a constructor with parameter name and set health = 100;.
Create getter methods for name and health and setter method for
health.
@@ -8,16 +8,18 @@ Create getter methods for name and health and
weapon;. Create a constructor with parameter name. Call the super
constructor with the name. Create a setter method
setWeapon(Weapon weapon);.
-
Create a Weapon class with one abstract method strike(Warrior
+
Create a Weapon interface with one abstract method strike(Warrior
opponent); an no attributes.
To the Warrior class. Add a decHealth method with a single
parameter int amt. Set the health value to Math.max(0, health –
-amt); which will keep the health attribute from going negative. The getHealth
+amt);
which will keep the health attribute from going negative. Then
+call the opponent’s decHealth method. The getName, getHealth,
and setHealth from Person class will be used.
To the Warrior class add an attack method that takes a Warrior
opponent parameter. If this warrior’s health is positive and the
opponent’s health is positive and this warrior’s weapon is not null,
-print this warrior’s name is attacking the opponent’s name. Then, call the strike method of the weapon attribute of your warrior class. Finally, print the opponent’s name and health.
+print this warrior’s name is attacking the opponent’s name. Finally,
+ print the opponent’s name and health.
Use the provided Weapons and Main classes to validate your Warrior
and Weapon classes.