Name: Section: Class Schedule:: Animal ( Animal ( 0 ) Eat Walk (System. .Println (+ +)
Name: Section: Class Schedule:: Animal ( Animal ( 0 ) Eat Walk (System. .Println (+ +)
Name: Section: Class Schedule:: Animal ( Animal ( 0 ) Eat Walk (System. .Println (+ +)
Imperial, Lhester O.
Section: Class Schedule:
2BSIT-2 TH 5:00 - 8:00 PM
3. Create a Fish class. Override the Animal methods to specify that fish can't walk and don't
have legs.
4. Create a class (TestAnimals) with a main method to test out your classes.
a) Create an object from the Spider class, test out all methods
b) Create an object from the Fish class, test out all methods
public Animal() {
legs=0;
}
public Spider() {
legs = 8;
}
public Fish() {
legs=0;
}
s.eat();
s.walk();
f.eat();
f.walk();
}
}
Paste Screenshot of Sample output:
B. Create a Class Diagram for your classes.
Write your Class diagram here
Animal
#legs : int
+Animal()
+eat() : void
+walk() : void
Spider Fish
+Spider() +Fish()
+eat() : void +eat() : void
+walk() : void