Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create an empty project with a name of your choosing, and in that project create a package called eecs 2 0 3 0 . lab
Create an empty project with a name of your choosing, and in that project create a package called
eecslab
Implement class Bird in the package eecslab that represents an immutable bird object.
A bird has a type, represented as a string egPigeonGooseChicken and its
weight in grams nonwhole numbers are possible
Two public constructors should exist:
public BirdString type, double sizeGrams
public Bird
The second constructor creates a Bird object of an unknown type, grams in weight
Implement equals, hashCode, and toString methods. Two birds are to be considered
equal if they are of the same type, and their weight is equal when rounded to the nearest
multiple of g There is no set format for toString, as long both pieces of information
stored in the object are printed.
Two additional public methods should exist:
public String getType
public double getSizeGrams
Think about how the immutability is ensured whenever you implement a
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started