Question
need a java program with a specific output. please see pic attached. Define a class whose objects are records on animal species. The class should
need a java program with a specific output. please see pic attached.
Define a class whose objects are records on animal species. The class should have
instance variables for the species name, population, and growth rate. The growth
rate is a percentage that can be positive or negative and can exceed 100 percent.
Include a suitable collection of constructors, mutator methods, and accessor
methods. Include a toString method and an equals method. Include a boolean
valued method named endangered that returns true when the growth rate is
negative and returns false otherwise. Write a test program (or programs) that
tests each method in your class definition.
Must create a Species Record class: SpeciesRecord.java
This is what the output needs to be:
Record is: Name: current population 0, growth rate: 0.004 Setting name. Record is now: Name: Unicorn, current population 0, growth. rate: 0.004 Record is Name Rabbit, current population. 0, growth rate 0.004 Record is Name Horse population 3000 growth rate 0.004 current Setting growth rate. Record is now: Name: Horse, current population: 3000 growth rate: 56.704 Record is Name Dodo, current population 0, growth rate 33.504 Setting population. Record is now: Name: Dodo, current population: 2, growth rate 33.505 Record is: Name: German Shepherd current population 550, growth rate 45.006 Getting population of rabbits: 0 Getting growth rate of German Shepherds 45.006 Getting name from first record Unicorn. The Dodo is red The r abbit is e ndangered false Horses and Unicorns are the same: false Making an identical object of German Shepherds Duplicate record is Name German Shepherd current population: 550 growth. rate: 45.004 Duplicate is same as original German Shepherd: true BUILD SUCCESSFUL total time 0 seconds
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