Question: 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.
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: Flying Speed ightGRAVITY Current Elevation=Current Elevation+ Weight Weight-3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
