Beginning Java programming: Help with Writing main method, which is 2nd part of the question inside the black box. [using system print out] function.
4. Implement the Bird class using BlueJ. The Bird class has the following fields: name (String): Stores the name of the bird size (double): Stores the size of the bird flying speed (int): Stores the flying speed of the bird weight (double): Stores the weight of the bird current elevation (int): Stores the current elevation of the bird count: Stores the number of birds created GRAVITY: A constant with a value of 9.8. The class should have the following constructor and methods: .A constructor that accepts the following arguments and assigns them to the appropriate fields: name, size, flying speed, and weight. Constructor should assign 0 to current elevation and increment the count field by 1. Get methods for all the fields Set methods for the name field. . . Eat method will accept amount of food as parameter and will update the size and weight fields using the following formulae: size = size+ amount of food *2 100 weight = weight + amount of food *5 100 . Fly Up method will update the current elevation and weight fields using the following formulae: Current Elevation = Current Elevation + Flying Speed weight *GRAVITY Weight = Weight -3
Fly Down method will update the current elevation and weight fields using the following formulac: Current Elevation = Current Elevation- _Flying Speed weight . GRAVITY Weight = Weight -1 Once you have written the Bird class, write a separate java class called BirdDemo (with main method) that creates three bird objects to hold the following data: Name Size Flying Speed Weight Blue J I 10 100 3.8 Blue J 2 12 95 3.5 Blue] 3 15 125 3 The program should store the data in three objects of bird type and than: Display total number of birds Display information about Blue J I Feed 10 grams of food to the Blue J I Display information about Blue J I Display information about Blue J 2 Make Blue J 2 fly up Display information about Blue J 2 Display information about Blue J 3 Make Blue J 3 fly down Display information about Blue J 3 Do not forget to include the JavaDoc and Make sure that you can compile and run your program. What to Hand in I. Question 1, 2 and 3 can be done using Microsoft Office, Open Office, or plain old text editor. Submit the document using Moodle. 2. Question 4 must be done using BlueJ. Zip your project folder and submit using Moodle.
416,475 students got unstuck by Course
Hero in the last week
Our Expert Tutors provide step by step solutions to help you excel in your courses