Suppose you are working for a Zoo and you are asked to write the class for keeping information about animals. You decide to call your class Animal. Write the class Animal that represents an animal. The attributes are the animal id, the species, price, and a flag indicating whether it is currently being in a show. Note that, when an animal is created, unique new id number is allocated to id. This id number will be generated by adding one to the previously used id number, which is kept stored in a variable shared by all Animal objects. Include accessors for all attributes, a mutator to change the flag, and a method to increase the price. Two most necessary constructors (that will be used create new animals).

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 2CP
icon
Related questions
Question

1

Question 2
Suppose you are working for a Zoo and you are asked to write the class for keeping information about animals. You decide to call your class Animal.
Write the class Animal that represents an animal.
The attributes are the animal id, the species, price, and a flag indicating whether it is currently being in a show.
Note that, when an animal is created, a unique new id number is allocated to id. This id number will be generated by adding one to the previously used id number, which is kept stored in a variable shared by all Animal
objects.
Include accessors for all attributes, a mutator to change the flag, and a method to increase the price.
Two most necessary constructors (that will be used create new animals).
Transcribed Image Text:Question 2 Suppose you are working for a Zoo and you are asked to write the class for keeping information about animals. You decide to call your class Animal. Write the class Animal that represents an animal. The attributes are the animal id, the species, price, and a flag indicating whether it is currently being in a show. Note that, when an animal is created, a unique new id number is allocated to id. This id number will be generated by adding one to the previously used id number, which is kept stored in a variable shared by all Animal objects. Include accessors for all attributes, a mutator to change the flag, and a method to increase the price. Two most necessary constructors (that will be used create new animals).
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage