Repository navigation
Expand file tree
/
Copy pathUserDefinedClasses.java
More file actions
89 lines (77 loc) · 2.65 KB
/
Copy pathUserDefinedClasses.java
File metadata and controls
89 lines (77 loc) · 2.65 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
* Inheritance lab where the parent class is animals with different sub classes for types of animals and their objects.
*
* @author Ainsley Pyle
*
* Created at : 2023-10-02 11:55:11
* Last modified : 2023-10-16 19:42:30
*/
public class UserDefinedClasses{
public static void main(String[] args)
{
//Mammal Instantiated Classes
System.out.println("Ted the dog:");
Dog ted=new Dog(12);
ted.setBreed("Poodle");
ted.setSpots(33);
ted.dog_info();
System.out.println();
System.out.println("Timmy the cow:");
Cow timmy=new Cow(2);
timmy.setWeight(400);
timmy.cow_info();
//Reptile Instanstiated Classes
System.out.println();
System.out.println("Carrie the Crocodile");
Crocodile Carrie=new Crocodile(3);
Carrie.setSkinType(" Rough");
Carrie.setTeeth(150);
Carrie.Crocodile_info();
System.out.println();
System.out.println("Sally the Snake");
Snake Sally=new Snake(5);
Sally.setSkinType("Scaley");
Sally.setLength(10);
Sally.Snake_info();
System.out.println();
//Fish instantiated classes
System.out.println("Simon the Shark");
Shark Simon=new Shark(40);
Simon.setScaleColor("grey");
Simon.setTeeth(200);
Simon.Shark_info();
System.out.println();
System.out.println("Cole the Clownfish");
ClownFish Cole= new ClownFish(1);
Cole.setScaleColor("orange and white");
Cole.setStripes(4);
Cole.Clownfish_info();
System.out.println();
//Bird Instantiated Classes
System.out.println("Edgar the Eagle");
Eagle Edgar=new Eagle(6);
Edgar.setFeatherCount(50);
Edgar.setTalons(6);
Edgar.Eagle_info();
System.out.println();
System.out.println("Gary the Goose");
Goose Gary=new Goose(7);
Gary.setFeatherCount(43);
Gary.setWeight(10);
Gary.Goose_info();
System.out.println();
//Amphibian Instatiated Classes
System.out.println("Fred the Frog");
Frog Fred= new Frog(14);
Fred.setColor("green");
Fred.setLegs(4);
Fred.Frog_info();
System.out.println();
System.out.println("Sam the Salamander");
Salamander Sam= new Salamander(2);
Sam.setColor("Orange");
Sam.setTail(3);
Sam.Salamander_info();
System.out.println();
}
}