Question: Create new project 1) Create a domain class called Bird Bird class will contain the following attributes: - Name (String) - Height (double) - Weight
Create new project
1) Create a
domain
class called
Bird
Bird class will contain the following attributes:
-
Name (String)
-
Height (double)
-
Weight (double)
-
Speed (double)
-
canFly (Boolean)
Your constructor will receive name, height, weight and a value for canFly
*Speed will be a random number between 10 and 25 generated IN the constructor*
2) Create a
text file
with the following: *the info pattern is: name height weight canFly*
birdA 5.1 10.2 true
birdB 7.2 20.5 false
birdC 6.9 15.7 true
birdD 5.1 10.7 false
birdE 9.8 9.9 true
birdF 8.9 17.3 false
3) Create
driver
class
*declare a global array of Birds
*In main call methods: ReadAndCreate(), PrintBirds(), BirdStats(), FlyAway()
3a)
ReadAndCreate
()
- read file and count records(lines) with a counter, initialize array to that size.
- read file and extract information, create Bird object
- insert Bird object in Bird array
3b)
PrintBirds
()
- Print out all birds in the array
3c)
BirdStarts
()
- loop through array and find:
- Bird with the maximum height,
- the Bird with the maximum weight,
- the Bird with the maximum speed
*note it says
Bird with ...
meaning, print the Bird object that you found has the max in that
attribute*
3d) FlyAway()
- print all Birds in array that
can
fly
- print all Birds in array that can
not
fly
Annotations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
