Question: Write a class called Dragon. A Dragon should have a level and an attack. The class should have getter methods for each of these variables.

Write a class called Dragon. A Dragon should have a level and an attack. The class should have getter methods for each of these variables.
The Dragons level is an integer. The Dragons attack is a String.
Dragon will also need a constructor, getters, and an attack method.
The constructor should take the level as the first argument and the attack as the second argument.
You should create two getter (accessor) methods called getAttack() and getLevel().
You should also create a method called fight(). This method should return a string that repeats the attack string once for each level. For example, if the attack string is > and the level is 6, then fight() would return >>>>>>
In summary, you should have the following methods:
A constructor that takes two parameters - the level and attack (in that order)
getAttack
getLevel
fight

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!