Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 :

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Unity From Zero To Proficiency Beginner A Step By Step Guide To Coding Your First Game

Authors: Patrick Felicia

1st Edition

1091872023, 978-1091872028

More Books

Students also viewed these Programming questions

Question

What are the tasks of marketing?

Answered: 1 week ago