Purchase Solution

Abstract Classes of Fish

Not what you're looking for?

Ask Custom Question

Create an abstract class called Aqualife.
Aqualife has the following attributes:
name
age
lakeFish
oceanFish

Aqualife defines 2 abstract methods called eats() and procreates().
A third concrete method called breathes() displays that 'These creatures breathe from gills.'
Create subclasses of Aqualife:
Fish
Whale

Fish has an attribute which stores whether the fish is an herbivore or a carnivore. Its eats method checks whether herbivore or carnivore, and prints 'This fish eats veggies' for herbivores and 'This fish eats other fish' for carnivores. Its procreates method prints 'Fish lay eggs'.
Whale has an attribute that specifies whether the whale is a blue whale or a killer whale. If the whale is a blue whale, it eats veggies, if it is a killer whale it eats meat. Its procreates method prints that whales are mammals. It overrides the breathes method from the parent class. This method must print 'These mammals breathe above water'.

Purchase this Solution

Solution Summary

The expert determines the abstract classes of fish as carnivores or herbivores.

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic Networking Questions

This quiz consists of some basic networking questions.

Javscript Basics

Quiz on basics of javascript programming language.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.