Question: i want the solution to this : Exercise 2: Based on the following UML of GameChar class: Create the Java class GameChar. (default constructor set
i want the solution to this :

Exercise 2: Based on the following UML of GameChar class: Create the Java class GameChar. (default constructor set to: name as "player" - 100 points - 1 points/hit - 1 hit/sec Use a test program to create three objects of type City: playerl: Kim - 200 points - 2 points/hit - 2 hit/sec V V player2: Tom - 300 points - 3 points/hit - 0.5 hit/sec player3: no details (call default constructor) Update "player3" to: Ben - 150 points - 3 points/hit - 4 hit/sec v Design fightWinner method in the test program that takes two GameChar objects and print the name of the winning character. Hint: the winner is the character that need less time to end the fight. Time Player = Math.ceil ( lifePoints(opponent) / strength(Player) ) / speed(Player) V Print the winning scenarios between playerl, player2 and player3 using fight Winner method. (P1 vs P2 , Pl vs P3, and P2 vs P3). GameChar - name: String - lifePoints: int - strength: int - speed: double + GameChar () + GameChar (String, int, double) + setName(String): void + getName(): String + setLifePoints(int): void + getLifePoints (): int + setStrength(int): void + getStrength (): int + setSpeed (double): void + getSpeed (): double + toString(): String
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
