Java OOP GUIDE / WORK RANGEDWEAPON CLASS 2 Topics
TASK –
PART 1 – SETUP You
will need to copy an paste the following classes
from the RangedWeapon class solution and work
sections. ·
Weapon
(from the work section) ·
Projectile
(from the solution section) ·
RangedWeapon
(from the solution section) TASK –
PART 2 – MORE SETUP Copy and
paste the following Tester class.
(Feel free to rename it Tester2 if Tester is already taken.)
TASK –
PART 3 – POLYMORPHISM In
the main function from the above Tester class, do the following: ·
Add
a Weapon array of size 8. ·
Place
the 8 weapons (w1 to w8) into the array. ·
Simulate
a round of attack using each weapon. Use
a loop. Output the damage done by each
weapon and the total damage from the round. ·
Place
the above loop inside another loop to simulate 20 rounds of attack. ·
Total
the entire damage done and output it to screen. |
|
|