Answered step by step
Verified Expert Solution
Link Copied!

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
eecs2030.lab3.
Implement class Bird in the package eecs2030.lab3 that represents an immutable bird object.
A bird has a type, represented as a string (e.g.,Pigeon,Goose,Chicken) and its
weight in grams (non-whole numbers are possible)
Two public constructors should exist:
public Bird(String type, double sizeGrams)
public Bird()
The second constructor creates a Bird object of an unknown type, 350 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 20 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions