Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Search Modules Library Resources Bursaries and Graduate Programme Orientation Content AWS signup form Richfield DL Bot Time left 0 : 5 3 : 1 2

Search Modules
Library
Resources
Bursaries and Graduate Programme
Orientation Content
AWS signup form
Richfield DL Bot
Time left 0:53:12
Hide
Question 8
Not yet answered
Flag question
4. You are tasked with developing a robust system for managing different types of animals in a zoo. The system must adhere to object-oriented principles, utilizing interfaces, abstract classes, and inheritance effectively.
Define an interface named IAnimal with the following members:
Method void Eat() to simulate the animal's eating behaviour.
Property string Name to store the name of the animal.
Property int Age to store the age of the animal.
Create an abstract class named AnimalBase that implements the IAnimal interface. The
AnimalBase class should include the following:
An abstract method void MakeSound() to be implemented by derived classes.
Implementation of the IAnimal interface members.
Additional property string Species to store the species of the animal.
Derive two concrete classes from the AnimalBase class:
Lion: Represents a lion in the zoo.
Implement the MakeSound() method to output the lion's roar.
Set the Species property to "Panthera leo".
Elephant: Represents an elephant in the zoo.
Implement the MakeSound() method to output the elephant's trumpet.
Set the Species property to "Loxodonta africana".
Write a console application to test the functionality of your implemented classes. The application should create instances of both Lion and Elephant classes, call their methods to simulate eating and making sounds, and display relevant information about each animal.
(25 Marks)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

please dont use chat gpt AI 2 4 0 .

Answered: 1 week ago