Question
thre wanted output : what i did which is wrong ! : instructor notes : / Create an animal and print its info // Parameters
thre wanted output :
what i did which is wrong ! :
instructor notes :
/ Create an animal and print its info
// Parameters here are: Name, age, number of meals per day, and type (1
// = tiger, 2 = elephant, 3 = turtle, 4 = puffin)
There is a difference between the Type and ID attributes. In the example given by the Runner.java, the Elephant's ("Calvin") ID is indeed 1 but its Type is 2. Similarly, the Tiger's ("Fluffy") ID is 2 but its Type is 1.
While the ID should be automatically generated for each animal (in the order of creation), the type is always 1 for tigers and 2 for elephants. Moreover, if the Runner class had created a third animal (let's say another tiger), its ID is going to be 3 since it was the third animal created.
how do i create auto generated id in the class what i did was competly wrong ?
w .java. oce upe, Te outputo your poa the following: ID / Name Age CPD --------- 1) Calvin 5 960 (Elephant 4 320 (tiger) 320 ( Tiger 2 ) Fluffy Setting number of meals per day of Fluffy to 2 2 Fluffy 4640 Tiger Setting number of meals per day to 30! Error, animals cannot eat more than 3 meals per day! Fluffy 640 Ti GerStep 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