Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In (JAVA) object oriented programming Write the necessary codes for the given UML class diagrams. In main method, create 2 objects; one from KibishiFighter and
In (JAVA) object oriented programming
Write the necessary codes for the given UML class diagrams. In main method, create 2 objects; one from KibishiFighter and one from HybridFighter classes, and create variable called isDead (boolean). While any Fighter is alive (isDead false), one should attack another, and its opponent should defense. Each attack method (attackTo, judo Attack To etc.) should decrease (you decide amount) the health of opponent Fighters. Defense methods increase belonging fighter's health. Print out their health when one is dead. Note that methods in KibishiFighter and Hybrid Fighter classes were not written. However, you can know them using parent-child (superclass-subclass) relationship given by UML. > > > Judo AttackBehaviours MuayThaiAttackBehaviour - BoxingAttackBehaviour -Fighter judo AttackTo(Fighter opponent) - Fighter muayThaiAttackTo(Fighter opponent) -Fighter boxingAttackTo(Fighter opponent) > Fighter #String name I sint health > > > +Fighter (int health, String name) --Fighter attackTo(Fighter opponent) -void defensel HybridFighter KibishiFighter + Hybrid Fighter (int health, String name) +KibishiFighter(int health, String name) OOPfinal02 + static String[] main(String[] args) Question 2[50pt]: Write the necessary codes for the given UML class diagrams. In main method, create 2 objects, one from KibishiFighter and one from HybridFighter classes, and create variable called is Dead (boolean). While any Fighter is alive (isDead false), one should attack another, and its opponent should defense. Each attack method (attackTo, judoAttackTo etc.) should decrease (you decide amount) the health of opponent Fighters. Defense methods increase belonging fighter's health. Print out their health when one is dead. Note that methods in KibishiFighter and HybridFighter classes were not written. However, you can know them using parent-child (superclass-subclass) relationship given by UML. > > > JudoAttackBehaviours Muay ThaiAttackBehaviour - BoxingAttackBehaviour -Fighter judoAttack To[Fighter opponent) -Fighter MuayThaiAttackTo(Fighter opponent) -Fighter boxingAttackTo(Fighter opponent) > > > +Fighter (int health. String name) -Fighter attackTo(Fighter opponent) -void defense 1 HybridFighter KibishiFighter +HybridFighter (int health, String name) * Kibishi Fighter(int health, String name) OOPfinal02 +static Stringll main(Stringil args)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started