Advanced Placement (AP)
28.04.2022 13:13
276
467
5
Solved by an expert

SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume

SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied.
In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit.

A set of classes using inheritance is used to represent animals observed at a wildlife sanctuary. A portion of the class hierarchy is shown in the following diagram.

The figure presents a diagram of a class hierarchy with three levels. The highest level has one class labeled Animal. The middle level has two classes labeled Carnivore and Herbivore. The lowest level has one class labeled Elephant. Three arrows are drawn: one from Elephant to Herbivore, one from Herbivore to Animal, and one from Carnivore to Animal.
All Animal objects have the following attributes.

A String variable indicating whether the animal is a carnivore or a herbivore
A String variable representing the animal species (e.g., lion, giraffe, zebra)
A String variable representing the name of the individual animal (e.g., Lisa, Gary, Percy)
The Animal class also contains a toString method that indicates the state of an animal.

The following table shows the intended behavior of the Animal class.

Statement Result
Animal lisa = new Animal("carnivore", "lion", "Lisa"); A new Animal object is created.
lisa.toString(); The string "Lisa the lion is a carnivore" is returned.
(a) Write the complete Animal class. Your implementation must meet all specifications and conform to the behavior shown in the table.

Question 2
The Herbivore class is a subclass of Animal. The Herbivore class does not contain any attributes or methods other than those found in the Animal class.

The constructor to the Herbivore class accepts two parameters for the species and name of the herbivore. The constructor passes those parameters along with the string literal "herbivore" to the Animal class to construct the object.

The following table shows the intended behavior of the Herbivore class.

Statement Result
Herbivore gary = new Herbivore("giraffe", "Gary"); A new Herbivore object is created.
gary.toString(); The string "Gary the giraffe is a
herbivore" is returned.
(b) Write the complete Herbivore class. Your implementation must meet all specifications and conform to the behavior shown in the table.

Question 3
The Elephant class is a subclass of Herbivore. The Elephant class contains one additional attribute not found in Herbivore: a double variable representing the length of the elephant’s tusks, in meters.

The constructor to the Elephant class accepts two parameters for the name and tusk length of the elephant. The constructor passes those parameters along with the string literal "elephant" to the Herbivore class to construct the object.

The following table shows the intended behavior of the Elephant class.

Statement Result
Elephant percy = new Elephant("Percy", 2.0); A new Elephant object is created.
percy.toString(); The string "Percy the elephant is a
herbivore with tusks 2.0 meters long" is returned.
(c) Write the complete Elephant class. Your implementation must meet all specifications and conform to the behavior shown in the table.

CAN ANYONE PROVIDE THE COLLEGEBOARD FILE FOR THE SOLUTION TO THIS FRQ? THIS IS AP COMPUTER SCIENCE A UNIT 9 FRQ.
Show Answers
mathsux6600
mathsux6600
4,5(40 marks)

d. all of the above

Explanation:

You should be referring to how to fill out the “Other Experience” category in a curriculum. Well, as we know the curriculum has a category called "experience" which refers to your professional experience, ie in this category you will put information about your previous jobs, including internships. However, any experience you have that does not refer to an employment experience should be placed in the “Other Experience” category, which includes military service, awards won, leadership opportunities, and others.

Popular Questions about the subject: Advanced Placement (AP)

Can a moderator delete my acc for me plz? If u know one or are...
Advanced Placement (AP)
14.05.2020 00:34
PLEASE HELP FAST, AP HUMAN GEOGRAPHY E-S-P-N CHART ABOUT BIRTH...
Advanced Placement (AP)
12.03.2020 17:18
What do reviewers do for readers?...
Advanced Placement (AP)
04.06.2023 20:19
ONLY ANSWER IF U ARE A MODERATOR OR KNOW ONE Plz delete my acc...
Advanced Placement (AP)
01.05.2020 04:45
Describe at least one visual characteristic of the Church of...
Advanced Placement (AP)
14.01.2021 10:04
What are examples of Finance careers? Select three options.Bank...
Advanced Placement (AP)
02.05.2020 09:09
Random question! trying to calm down after life today! does anyone...
Advanced Placement (AP)
11.05.2021 16:46
What specialized tool is used to remove gears, pulleys, and various...
Advanced Placement (AP)
21.06.2022 07:12
Injuries to the occur most often when heavy materials or tools...
Advanced Placement (AP)
02.09.2022 01:00

New questions by subject

Draw the line of reflection that reflects triangle ABC onto triangle...
Mathematics
06.01.2023 04:10
3х + 10 = 24 12х – у= -27...
Mathematics
04.11.2020 13:26
Pls help 50 points, easy questions...
Biology
12.01.2023 11:19
The first people to settle in North America are known as...
History
21.04.2023 05:06
What do you notice about the spacing of the foci when the ellipse...
Geography
17.04.2023 02:14
#
#
#
#
# #

We expand our knowledge with many expert answers