Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
Zoo Application
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jinny.wilkin
Zoo Application
Commits
9b6e04b4
Commit
9b6e04b4
authored
May 14, 2022
by
jinny.wilkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
final variables + animal creator
parent
2495f873
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
97 additions
and
31 deletions
+97
-31
Baboon.java
Baboon.java
+3
-2
Bird.java
Bird.java
+7
-5
Catfish.java
Catfish.java
+2
-2
Duck.java
Duck.java
+9
-2
Emu.java
Emu.java
+6
-2
Fish.java
Fish.java
+1
-3
Lion.java
Lion.java
+2
-2
Mammal.java
Mammal.java
+1
-4
Parrot.java
Parrot.java
+6
-2
PufferFish.java
PufferFish.java
+4
-3
RedPanda.java
RedPanda.java
+2
-2
Shark.java
Shark.java
+2
-2
Zoo.java
Zoo.java
+52
-0
No files found.
Baboon.java
View file @
9b6e04b4
...
@@ -7,8 +7,8 @@ public class Baboon extends Mammal{
...
@@ -7,8 +7,8 @@ public class Baboon extends Mammal{
hierarchy
=
0
;
hierarchy
=
0
;
}
}
public
Baboon
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
hgt
,
String
fc
,
String
loco
,
int
hrchy
){
public
Baboon
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
hgt
,
String
loco
,
int
hrchy
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
hgt
,
fc
,
loco
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
hgt
,
loco
);
hierarchy
=
hrchy
;
hierarchy
=
hrchy
;
}
}
...
@@ -16,4 +16,5 @@ public class Baboon extends Mammal{
...
@@ -16,4 +16,5 @@ public class Baboon extends Mammal{
public
void
shout
(){
public
void
shout
(){
System
.
out
.
println
(
"OOAAAAOOOAAAAHAAAWWOOOHAAA"
);
System
.
out
.
println
(
"OOAAAAOOOAAAAHAAAWWOOOHAAA"
);
}
}
}
}
Bird.java
View file @
9b6e04b4
import
java.text.DecimalFormat
;
abstract
class
Bird
extends
Animal
{
abstract
class
Bird
extends
Animal
{
protected
double
wingSpan
;
protected
double
wingSpan
;
protected
double
migration
;
protected
String
featherColour
;
protected
String
featherColour
;
protected
static
final
DecimalFormat
df
=
new
DecimalFormat
(
"0.00"
);
public
Bird
(){
public
Bird
(){
super
();
super
();
this
.
wingSpan
=
5.5
;
this
.
wingSpan
=
5.5
;
this
.
migration
=
120
;
this
.
featherColour
=
"Green"
;
this
.
featherColour
=
"Green"
;
}
}
public
Bird
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
ws
,
double
mig
,
String
fc
){
public
Bird
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
ws
,
String
fc
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
);
this
.
wingSpan
=
ws
;
this
.
wingSpan
=
ws
;
this
.
migration
=
mig
;
this
.
featherColour
=
fc
;
this
.
featherColour
=
fc
;
}
}
public
void
flight
(){
public
void
flight
(){
System
.
out
.
println
(
this
.
name
+
" flew "
+
df
.
format
(
this
.
speed
)
+
"m!"
);
}
}
}
}
Catfish.java
View file @
9b6e04b4
...
@@ -2,8 +2,8 @@ public class Catfish extends Fish{
...
@@ -2,8 +2,8 @@ public class Catfish extends Fish{
protected
double
whiskerLength
;
protected
double
whiskerLength
;
public
Catfish
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
String
culs
,
int
md
,
int
len
,
double
wl
){
public
Catfish
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
String
culs
,
int
len
,
double
wl
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
culs
,
md
,
len
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
culs
,
len
);
whiskerLength
=
wl
;
whiskerLength
=
wl
;
}
}
...
...
Duck.java
View file @
9b6e04b4
public
class
Duck
extends
Bird
{
public
class
Duck
extends
Bird
{
public
Duck
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
ws
,
double
mig
,
String
fc
){
protected
Boolean
bread
=
true
;
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
ws
,
mig
,
fc
);
public
Duck
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
ws
,
String
fc
,
boolean
brd
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
ws
,
fc
);
bread
=
brd
;
if
(!
bread
){
bread
=
true
;
}
}
}
public
void
swim
(){
public
void
swim
(){
System
.
out
.
println
(
this
.
name
+
"swims around the pond happily"
);
System
.
out
.
println
(
this
.
name
+
"swims around the pond happily"
);
}
}
}
}
Emu.java
View file @
9b6e04b4
...
@@ -6,9 +6,13 @@ public class Emu extends Bird{
...
@@ -6,9 +6,13 @@ public class Emu extends Bird{
this
.
runningSpeed
=
20
;
this
.
runningSpeed
=
20
;
}
}
public
Emu
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
ws
,
double
mig
,
String
fc
){
public
Emu
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
ws
,
String
fc
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
ws
,
mig
,
fc
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
ws
,
fc
);
this
.
runningSpeed
=
spd
*
3
;
this
.
runningSpeed
=
spd
*
3
;
}
}
@Override
public
void
flight
(){
System
.
out
.
println
(
"Emu's can't fly!"
);
}
}
}
Fish.java
View file @
9b6e04b4
abstract
public
class
Fish
extends
Animal
{
abstract
public
class
Fish
extends
Animal
{
protected
String
Colourings
;
protected
String
Colourings
;
protected
int
migrationDistance
;
protected
int
length
;
protected
int
length
;
public
Fish
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
String
culs
,
int
md
,
int
len
){
public
Fish
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
String
culs
,
int
len
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
);
Colourings
=
culs
;
Colourings
=
culs
;
migrationDistance
=
md
;
length
=
len
;
length
=
len
;
}
}
}
}
Lion.java
View file @
9b6e04b4
...
@@ -7,8 +7,8 @@ public class Lion extends Mammal{
...
@@ -7,8 +7,8 @@ public class Lion extends Mammal{
timeSpentAsleep
=
24
;
timeSpentAsleep
=
24
;
}
}
public
Lion
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
hgt
,
String
fc
,
String
loco
,
int
tsa
){
public
Lion
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
hgt
,
String
loco
,
int
tsa
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
hgt
,
fc
,
loco
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
hgt
,
loco
);
timeSpentAsleep
=
tsa
;
timeSpentAsleep
=
tsa
;
}
}
}
}
Mammal.java
View file @
9b6e04b4
abstract
public
class
Mammal
extends
Animal
{
abstract
public
class
Mammal
extends
Animal
{
protected
double
height
;
protected
double
height
;
protected
String
furColour
;
protected
String
locomotion
;
//Do they vibe on two legs or four?
protected
String
locomotion
;
//Do they vibe on two legs or four?
public
Mammal
(){
public
Mammal
(){
super
();
super
();
height
=
2.0f
;
height
=
2.0f
;
furColour
=
"nil"
;
locomotion
=
"wheels"
;
locomotion
=
"wheels"
;
}
}
public
Mammal
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
hgt
,
String
fc
,
String
loco
){
public
Mammal
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
hgt
,
String
loco
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
);
height
=
hgt
;
height
=
hgt
;
furColour
=
fc
;
locomotion
=
loco
;
locomotion
=
loco
;
}
}
...
...
Parrot.java
View file @
9b6e04b4
public
class
Parrot
extends
Bird
{
public
class
Parrot
extends
Bird
{
protected
int
volumeDecibels
;
public
Parrot
(){
public
Parrot
(){
super
();
super
();
volumeDecibels
=
155
;
}
}
public
Parrot
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
ws
,
double
mig
,
String
fc
){
public
Parrot
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
ws
,
String
fc
,
int
vdb
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
ws
,
mig
,
fc
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
ws
,
fc
);
volumeDecibels
=
vdb
;
}
}
public
void
mimicry
(
String
input
){
public
void
mimicry
(
String
input
){
...
...
PufferFish.java
View file @
9b6e04b4
public
class
PufferFish
extends
Fish
{
public
class
PufferFish
extends
Fish
{
protected
boolean
isExpanded
=
false
;
protected
boolean
isExpanded
=
false
;
protected
double
radiusExpanded
;
public
PufferFish
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
String
culs
,
int
md
,
int
len
){
public
PufferFish
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
String
culs
,
int
len
,
double
re
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
culs
,
md
,
len
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
culs
,
len
);
radiusExpanded
=
re
;
}
}
public
void
expansion
(){
public
void
expansion
(){
...
...
RedPanda.java
View file @
9b6e04b4
...
@@ -10,8 +10,8 @@ public class RedPanda extends Mammal{
...
@@ -10,8 +10,8 @@ public class RedPanda extends Mammal{
homeRange
=
2.1
;
homeRange
=
2.1
;
}
}
public
RedPanda
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
hgt
,
String
fc
,
String
loco
,
double
hora
){
public
RedPanda
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
double
hgt
,
String
loco
,
double
hora
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
hgt
,
fc
,
loco
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
hgt
,
loco
);
homeRange
=
hora
;
homeRange
=
hora
;
}
}
...
...
Shark.java
View file @
9b6e04b4
...
@@ -2,8 +2,8 @@ public class Shark extends Fish{
...
@@ -2,8 +2,8 @@ public class Shark extends Fish{
protected
int
teeth
;
protected
int
teeth
;
public
Shark
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
String
culs
,
int
md
,
int
len
,
int
tth
){
public
Shark
(
String
hb
,
String
fd
,
String
nm
,
int
a
,
String
integ
,
String
gnd
,
int
nol
,
int
spd
,
String
culs
,
int
len
,
int
tth
){
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
culs
,
md
,
len
);
super
(
hb
,
fd
,
nm
,
a
,
integ
,
gnd
,
nol
,
spd
,
culs
,
len
);
teeth
=
tth
;
teeth
=
tth
;
}
}
...
...
Zoo.java
0 → 100644
View file @
9b6e04b4
import
java.util.Scanner
;
public
class
Zoo
{
public
Animal
[]
animals
;
public
Object
[]
arr
=
new
Object
[
11
];
public
void
main
(){
}
public
void
createAnimal
(){
Scanner
input
=
new
Scanner
(
System
.
in
);
System
.
out
.
print
(
"What is the new animal: "
);
String
newAnimal
=
input
.
nextLine
();
if
(
newAnimal
.
toLowerCase
()
==
"baboon"
){
createBaboon
();
}
input
.
close
();
}
public
void
createAnimalClass
(){
Scanner
in
=
new
Scanner
(
System
.
in
);
System
.
out
.
print
(
"What kind of habitat do they need: "
);
arr
[
0
]
=
in
.
nextLine
();
System
.
out
.
print
(
"What food do they eat: "
);
arr
[
1
]
=
in
.
nextLine
();
System
.
out
.
print
(
"What is their name: "
);
arr
[
2
]
=
in
.
nextLine
();
System
.
out
.
print
(
"How old are they: "
);
arr
[
3
]
=
in
.
nextLine
();
System
.
out
.
print
(
"What kind of integument do they possess: "
);
arr
[
4
]
=
in
.
nextLine
();
System
.
out
.
print
(
"What is their gender: "
);
arr
[
5
]
=
in
.
nextLine
();
System
.
out
.
print
(
"How many legs do they have: "
);
arr
[
6
]
=
in
.
nextLine
();
System
.
out
.
print
(
"How fast are they: "
);
arr
[
7
]
=
in
.
nextLine
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment