Question: Write a class called Dragon. A Dragon should have a name, a level, and a boolean variable, canBreatheFire, indicating whether or not the dragon can

 Write a class called Dragon. A Dragon should have a name,a level, and a boolean variable, canBreatheFire, indicating whether or not the

Write a class called Dragon. A Dragon should have a name, a level, and a boolean variable, canBreatheFire, indicating whether or not the dragon can breathe fire. The class should have getter methods for all of these variables- getName, getlevel, Finally, you should have a method called gainExperience that takes no parameters. It should add 10 to the dragon's level and update canBreathefire f necessary Dragon will also need a constructor, a method to gain experience and a method to attack. In summary, you should have the following methods: . A constructor that takes two parameters-the name and The constructor should take the name as the first argument and the level as the second argument. The constructor should initialize canBreatheFirebased on the dragon's level. If the dragon is level 70 or higher, the dragon can breathe fire (meaning the third member variable should be set to true). You called getNane().getLevel(), and isFireBreather). You should also create a method called attack(). This method does not return anything. If the dragon can breathe fire, it should print level (in that order) . getName : getLevel isEireBreather . gainExperience getter (accessor) methods attack That's 10 angle brackets, then 14, then 14, then 10 (or copy and paste theml) If the dragon cannot breathe fire, it should print

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!