Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create new project 1) Create a domain class called Bird Bird class will contain

ID: 3915344 • Letter: C

Question

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

Explanation / Answer

Solution:

##########Bird.java#########

#####Driver.java###########

Sample Run:

Bird
Name = 'birdA', Height=5.1, Weight=10.2, Speed=17.0, CanFly=true
Bird
Name = 'birdB', Height=7.2, Weight=20.5, Speed=16.0, CanFly=false
Bird
Name = 'birdC', Height=6.9, Weight=15.7, Speed=13.0, CanFly=true
Bird
Name = 'birdD', Height=5.1, Weight=10.7, Speed=19.0, CanFly=false
Bird
Name = 'birdE', Height=9.8, Weight=9.9, Speed=11.0, CanFly=true
Bird
Name = 'birdF', Height=8.9, Weight=17.3, Speed=14.0, CanFly=false
birdE has the max height
birdA has the max weight
birdA has the max Speed
List of Birds that can fly.
birdA
birdC
birdE
List of Birds that can fly.
birdB
birdD
birdF

Note: If you liked the solution then hit the like button, if you have any doubt then do comment below.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote