Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need this program in Java. A complete program please. Program Requirements Create an abstract class named ZooAnimal A private String data field sound A

I need this program in Java. A complete program please.

Program Requirements

Create an abstract class named ZooAnimal

A private String data field sound

A private String data field name

A private int data field numberOfLegs

A private double data field weight

An all-args constructor that creates a ZooAnimal for all private fields.

getter/setter methods for all private fields.

An abstract method calculateWeeklyFoodNeededPounds, returns double

create a toString method that prints all of the fields

Create a Tiger class. It extends ZooAnimal

a private String data field tigerType

An all-args constructor that creates a Tiger for all private fields.

getter/setter methods for all private fields.

a tiger needs to eat 15% of it's weight each week. Use this for calculateWeeklyFoodNeededPounds

create a toString method that prints all of the fields

Create a Gorilla class. It extends ZooAnimal

a private String gorillaType

An all-args constructor that creates a Tiger for all private fields.

getter/setter methods for all private fields.

a gorilla needs to eat 50% of it's weight each week. Use this for calculateWeeklyFoodNeededPounds

create a toString method that prints all of the fields

Create a Test Program

Write a test program that prompts the user in a loop to create ZooAnimals.

Add each ZooAnimal to an Arraylist.

create a method that prints and calculates the cost of feeding the animals assume that gorilla food costs $2 lbs and tigers cost $4 lbs -- call this method after gathering the information below

Ask the following question;

What Type of Zoo Animal, enter T for Tiger or G for Gorilla?

{type}'s name?

{type}'s sound?

{type}'s number of leg?

{type}'s weight?

{type}'s type:

Enter another Zoo, enter Y for yes?

Use an Enhanced for loop and for each ZooAnimal print out the ToString and the calculateWeeklyFoodNeededPounds

Example output:

What Type of Zoo Animal, enter T for Tiger or G for Gorilla? T Tigers name? Billy Tigers sound? ROAR Tigers number of legs? 4 Tigers Weight? 569 Tigers type? Bengal Enter another Zoo Animal, enter Y for yes? Y What Type of Zoo Animal, enter T for Tiger or G for Gorilla? G Gorillas name? Joe Gorillas sound? ROAR Gorillas number of legs? 2 Gorillas Weight? 445 Gorillas type? Mountain Enter another Zoo Animal, enter Y for yes? n Tiger [tigerType=Bengal, sound=ROAR, name=Billy, numberOfLegs=4, weight=569.0] Gorilla [gorillaType=Mountain, sound=ROAR, name=Joe, numberOfLegs=2, weight=445.0] The cost to feed the Tiger Billy for a week: $341.40 The cost to feed the Gorilla Joe for a week: $445.00

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

Explain the nature of human resource management.

Answered: 1 week ago

Question

Write a note on Quality circles.

Answered: 1 week ago

Question

Describe how to measure the quality of work life.

Answered: 1 week ago