C# - C Sharp: Practical 4: Animal Management System
Giải phóng thời gian, khai phóng năng lực
ANIMAL MANAGEMENT SYSTEM
1. Design an interface IAnimal has some Properties:
int ID
string Name
int Age
2. Design interface ITerrestrialAnimal and IMarineAnimal inherit interface IAnimal , both interfaces have following method:
void Move( )
3. Design class Cat, Fish, Crocodile with following instructions:
- Class Cat inherits interface ITerestrial
- Class Fish inherits interface IMarineAnimal
- Class Crocodile inherits interface Iterestrial and IMarineAnimal
- Override method ToString( ) of three classes to print : Animal Type, Animal ID, Name, Age
- Rewrite method Move( ) of interface ITerestrialAnimal to print : Run
- Rewrite method Move( ) of interface IMarineAnimal to print : Swim
Tips: display Animal Type by using method GetType()
4. Build the menu of program:
1. Create a Crocodile
2. Create a Cat
3. Create a Fish
4. View Terrestrial Animals
5. View Marine Animals
6. View All Animals
7. Delete Animal
8. Exit
-When user choose 1, 2 or 3: create new animal with its ID increments automatically. ( ID ++). Afterthat, add the animal to an array IAnimal[] arr.
-When user choose 4: iterate all terrestrial animal in the array, call their methods ToString and Move
-When user choose 5: iterate all marine animal in the array, call their methods ToString and Move
-When user choose 6: iterate all animal in the array, call their methods ToString and Move
-When user choose 7: delete the animal in array that its ID equals the specified number.
Giải phóng thời gian, khai phóng năng lực