Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

thre wanted output : what i did which is wrong ! : instructor notes : / Create an animal and print its info // Parameters

thre wanted output :

image text in transcribed

what i did which is wrong ! :

image text in transcribed

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 Ger

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

Transactions On Large Scale Data And Knowledge Centered Systems Xxxviii Special Issue On Database And Expert Systems Applications Lncs 11250

Authors: Abdelkader Hameurlain ,Roland Wagner ,Sven Hartmann ,Hui Ma

1st Edition

3662583836, 978-3662583838

More Books

Students also viewed these Databases questions

Question

Find the indicated sums of matrices. | []+[ 109 3-5-2 4 -1 20-3 7

Answered: 1 week ago