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

I have a java question I need help answering. I can\'t get mine to work right. C

ID: 3550242 • Letter: I

Question

I have a java question I need help answering. I can't get mine to work right. Can someone please help me answer this question. Thank you.


Create a BirdSighting class for the Birmingham Birdwatcher's Club that includes data fields for a bird species sighted, the number seen, and the day of the year. For example, April 1 is the 91st day of the year, assuming its not a leap year. The class also includes methods to get each field. In addition, create a default constructor  that automatically set the species to "robin" and the number and day to 1. Save the file as BirdSighting.Java. Create an application named TestBirdSighting that demonstrates that each method works correctly. Save the file as TestBirdSighting.java


Create an addtional overloaded constructor for the BirdSighting class you created above. This constructor receives parameters for each of the data fields and assigns them appropriately. Add any needed statements to TestBirdSighting application to ensure that the overloaded constructor works correctly, save it, and then test it.


Thank you for your help.

Explanation / Answer

Since you have been tasked with creating a class that can be used to log bird sightings, it might help if you were to create a list or even a UML diagram that details how each aspect of the class should be turned into code.

For example, your list or breakdown of the class could include any potential attributes and methods that you think should be in the class, what parameters may be needed, what the return type of the methods should be, as well as anything else that you think may be necessary.

The BirdSighting class's constructor method should automatically instantiate an object of the BirdSighting class with the value of "robin" for the species sighted, as well as specify that the robin was sighted on "day 1".

By simply including the proper attributes and values in the constructor method, creating the default constructor method should be pretty simple.

For part b of this assignment, all you have to do is create an additional constructor method for the BirdSighting class, which should take the parameters described in part a, and will be called should the parameters be passed to the BirdSighting class's constructor method.

(If no parameters are passed into the constructor, then the default constructor method will be called, setting the bird sighted as a "robin" and the day as "day 1".)

For part c, you are creating two constructor methods (so you're overloading the constructor again), but this time, the default constructor should include a call to the overloaded constructor method that includes the three parameters that were mentioned in part a.