Code in Java Please Write a program to manage birds sitting on a telephone wire. Each bird has a name, weight, size, and position. The wire is 200 feet long, and birds only sit on whole number points on the wire - that is, a bird can sit at 122, but not 121.8 or 122.5. The size of a bird determines how much space it takes - a bird of size 5 sitting at 110 means that bird occupies points 108, 109, 110, 111, and 112. Bird sizes are always odd integers.
You will define a class Bird which keeps track of each bird's name, size, weight, and position (1 string, 3 integers). You will manage birds on the wire as a doubly-linked list. The minimum bird size is 1, and the maximum size is 9. The minimum weight is 1, and the maximum weight is 50.
You will prompt the user with the options to add a bird, delete a bird (by name), calculate the total weight (If the total weight exceeds 300, then print a warning message for the user), print out the birds (name, weight, size, position) in order on the wire, print the birds backwards, read inputs from a file called bird_data.txt, or to end the program.
bird_data.txt will have 3 types of lines:
- a bird_name bird_weight bird_size bird_position
- d bird_name
- e
These should act the same as if the user was entering things from the keyboard. I.e. "a …" adds a bird to the doubly-linked list. "d …" deletes a bird from the doubly-linked list. "e" ends reading from the file but does not end the overall menu. If a command from the file causes an error, print the error message on the console. So a sample file might have these lines:
a eagle 20 7 25
a robin 5 1 50
d eagle
e
There will still be a user menu for the user to do things manually (as in Program 5a), but the menu will include an option to read from the file and an option to print birds in reverse order.
For this program, the Bird class should be in Program6aBird and the main program should be in Program6a.