-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
30 lines (22 loc) · 829 Bytes
/
Main.java
File metadata and controls
30 lines (22 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
public class Main {
public static void main(String[] args) {
Animal animal = new Animal("Generic Animal","Huge",400);
doAnimalStuff(animal,"slow");
Dog dog = new Dog();
doAnimalStuff(dog,"fast");
Dog yorkie = new Dog("Yorkie",15);
doAnimalStuff(yorkie,"fast");
Dog retriever = new Dog("Labrador Retriever",65,"Floppy","Swimmer");
doAnimalStuff(retriever,"slow");
Dog wolf = new Dog("Wolf",40);
doAnimalStuff(wolf,"slow");
Fish goldie = new Fish("Goldfish","small",0.25,2,3);
doAnimalStuff(goldie,"fast");
}
public static void doAnimalStuff(Animal animal, String speed){
animal.makeNoise();
animal.move(speed);
System.out.println(animal);
System.out.println("_______");
}
}