Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java code please show clear steps This file defines a fighter object. Variables: All variables must not be allowed to be directly modified outside the

java code

please show clear steps

image text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed

This file defines a fighter object. Variables: All variables must not be allowed to be directly modified outside the class in which they are declared, unless otherwise stated in the description of the variable. The hero class must have variables: - health - HP of the fighter as a whole number - fighter - the name of the fighter for the game (example: Superman) - fighterType - the type of the fighter in the game. This variable must be of type fighterType. - Ability - the name of the ability for the fighter - mode - Switch fighters have a mode category ranging from 40 (inclusive) to 100 (inclusive). Ensure that mode is always a whole number in the range. mode is initialized, it should print "fighter mode: Insane" if the score is between [90, 100] "fighter mode: Excellent" if the score is between [80,89] "fighter mode: pretty Good" if the score is between [70, 79] "fighter mode: Good" if the score is between [60,69] "fighter mode: Fine" if the score is between [50, 59] points "fighter mode: Damaged" if the score is between [40,49] points. If the mode is not within the range, then set it to 80 and print the correct statement. This should only be printed when mode is first initialized. Constructor(s): - A constructor that takes in the health, fighter, fighterType, Ability, and mode - A constructor that takes in health, fighter, fighterType. In this case, Ability should be assumed to be "flashlight!" and mode should be assumed to be 80 . - A constructor that takes in no arguments. In this case, health should be 120, name should be "swagger", fighterType should be strong, ability should be "swaggy", and mode should be 89. Methods: All methods should have the proper visibility to be used where it is specified, they are used. - isRecovered This method returns true if the hero's mode is between [50,89], and false otherwise. - toString This method will return a String representation of a hero. The string must be formatted as follows (note the string is all in one line):

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

Database Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions