Question 3

a. Create a BirdSighting class for the Burmingham Birdwathcer'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 it is not a leap year. The class also includes methods to get each field. In addition, create a default constructor that automatically sets the species to "robin" and the number and day to 1. Save the file as BirtSighting.java. Create an application named TestBirdSighting that demonstrates that each method works correctly. Save the file as TestBirdSighting.java.

b. Create an additional overlaoded constructor for the BirdSighting class you created in Exercise 3a. This constructor receives parameters for each of the data fields and assigns them appropriately. Add any needed statements to the TestBirthSighting application to ensure that the overloaded constructor works correctly, save it, and then test it.

c. Create a class with the same functionality as the BirdSighting class, but create the default constructor to call the three-parameter constructor. Save the class as BirdSighting2.java. Create an application to test the new version of the class and name it TestBirdSighting2.java.

Question 6

a. Create a class named Circle with fields named radius, diameter, and area. Include a constructor that sets the radius to 1 and calculates the other two values. Also include methods named setRadius() and getRadius(). The setRadius() method not only sets the radius but also calculates the other two values. (The diameter of a circle is twice the radius, the area of a circle is pi multiplies by the square of the radius. Use the Math class PI constant for this calculation.) Save the class as Circle.java.

b. Create a class named TestCircle whose main() method declares several Circle objects. Using the setRadius() method, assign one Circle a small radius value, and assign another a larger radius value. Do not assign a value to the radius of the third circle; instead, retain the value assigned at construction. Display all the values for all the Circle objects. Save the application as TestCircle.java.

Question 8

Write an application that uses methods in the GregorianCalendar class to calculate how many days are left until the first day of next month. Save the file as NextMonth.java.

Add code for calculating the number of days remaining in the year. Add a message showing both the number of days remaining in this year and also the number of days remaining in the current month.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.