Computers and Technology

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, and isFireBreather, respectively. Dragon will alsomeed a constructor, a method to gain experience, and a method to attack. The constructor should take the name as the first argument and the level as the second argument. The constructor should initialize canBreatheFire based 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 should create three getter (accessor) methods called getNameO getLevelO, and isFireBreatherO You should also create a method called attackO. This method does not return anything. If the dragon can breathe fire, it should print >>>999 1 public class Dragon private String name; private int level; private boolean canBreatheFire; 4 7 // Write the constructor here! public String getName(name) 9 10 return name; 12 13 14 - 15 public int getLevel(level) return level; 16 17 /Put getters here 18 19 20 21 221/ String representation of the object 23 24 - 25 26 27 3 28 // Put other methods here public String toStringO return "Dragon+ name +" is at level "+ level; 1 public class DragonTester extends ConsoleProgram 2 4 6 public void runCO // Start here! 7

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 20:30, carealee
What important technology has done the most to allow a businesses a chance to compete with larger international companies
Answers: 1
image
Computers and Technology, 23.06.2019 01:20, shiann2002
Me with this program in c++ ! computers represent color by combining sub-colors red, green, and blue (rgb). each sub-color's value can range from 0 to 255. thus (255, 0, 0) is bright red. (130, 0, 130) is a medium purple. (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (in other word, equal amounts of red, green, blue yield gray).given values for red, green, and blue, remove the gray part. ex: if the input is 130 50 130, the output is: 80 0 80. thus, find the smallest value, and then subtract it from all three values, thus removing the gray.
Answers: 3
image
Computers and Technology, 24.06.2019 07:30, LuckyCharms988
Consider the folloeing website url: what does the "http: //" represent? a. protocal identifier. b. ftp. c. domain name d. resource name
Answers: 2
image
Computers and Technology, 24.06.2019 13:00, CarlosParker99
Think of a spreadsheet as a giant calculator spread of paper chart data collector
Answers: 2
Do you know the correct answer?
Write a class called Dragon. A Dragon should have a name, a level, and a boolean variable, canBreath...

Questions in other subjects:

Konu
Mathematics, 01.04.2020 05:58
Konu
Mathematics, 01.04.2020 05:58