[Added] initial project
This commit is contained in:
commit
d52f770cf1
12 changed files with 332 additions and 0 deletions
23
src/com/ing/zoo/Hippo.java
Normal file
23
src/com/ing/zoo/Hippo.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package com.ing.zoo;
|
||||
|
||||
public class Hippo {
|
||||
public String name;
|
||||
public String helloText;
|
||||
public String eatText;
|
||||
|
||||
public Hippo()
|
||||
{
|
||||
}
|
||||
|
||||
public void sayHello()
|
||||
{
|
||||
helloText = "splash";
|
||||
System.out.println(helloText);
|
||||
}
|
||||
|
||||
public void eatLeaves()
|
||||
{
|
||||
eatText = "munch munch lovely";
|
||||
System.out.println(eatText);
|
||||
}
|
||||
}
|
||||
23
src/com/ing/zoo/Lion.java
Normal file
23
src/com/ing/zoo/Lion.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package com.ing.zoo;
|
||||
|
||||
public class Lion {
|
||||
public String name;
|
||||
public String helloText;
|
||||
public String eatText;
|
||||
|
||||
public Lion()
|
||||
{
|
||||
}
|
||||
|
||||
public void sayHello()
|
||||
{
|
||||
helloText = "roooaoaaaaar";
|
||||
System.out.println(helloText);
|
||||
}
|
||||
|
||||
public void eatMeat()
|
||||
{
|
||||
eatText = "nomnomnom thx mate";
|
||||
System.out.println(eatText);
|
||||
}
|
||||
}
|
||||
47
src/com/ing/zoo/Pig.java
Normal file
47
src/com/ing/zoo/Pig.java
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
package com.ing.zoo;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Pig {
|
||||
public String name;
|
||||
public String helloText;
|
||||
public String eatText;
|
||||
public String trick;
|
||||
|
||||
public Pig()
|
||||
{
|
||||
}
|
||||
|
||||
public void sayHello()
|
||||
{
|
||||
helloText = "splash";
|
||||
System.out.println(helloText);
|
||||
}
|
||||
|
||||
public void eatLeaves()
|
||||
{
|
||||
eatText = "munch munch oink";
|
||||
System.out.println(eatText);
|
||||
}
|
||||
|
||||
public void eatMeat()
|
||||
{
|
||||
eatText = "nomnomnom oink thx";
|
||||
System.out.println(eatText);
|
||||
}
|
||||
|
||||
public void performTrick()
|
||||
{
|
||||
Random random = new Random();
|
||||
int rnd = random.nextInt(2);
|
||||
if(rnd == 0)
|
||||
{
|
||||
trick = "rolls in the mud";
|
||||
}
|
||||
else
|
||||
{
|
||||
trick = "runs in circles";
|
||||
}
|
||||
System.out.println(trick);
|
||||
}
|
||||
}
|
||||
41
src/com/ing/zoo/Tiger.java
Normal file
41
src/com/ing/zoo/Tiger.java
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package com.ing.zoo;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Tiger {
|
||||
public String name;
|
||||
public String helloText;
|
||||
public String eatText;
|
||||
public String trick;
|
||||
|
||||
public Tiger()
|
||||
{
|
||||
}
|
||||
|
||||
public void sayHello()
|
||||
{
|
||||
helloText = "rraaarww";
|
||||
System.out.println(helloText);
|
||||
}
|
||||
|
||||
public void eatMeat()
|
||||
{
|
||||
eatText = "nomnomnom oink wubalubadubdub";
|
||||
System.out.println(eatText);
|
||||
}
|
||||
|
||||
public void performTrick()
|
||||
{
|
||||
Random random = new Random();
|
||||
int rnd = random.nextInt(2);
|
||||
if(rnd == 0)
|
||||
{
|
||||
trick = "jumps in tree";
|
||||
}
|
||||
else
|
||||
{
|
||||
trick = "scratches ears";
|
||||
}
|
||||
System.out.println(trick);
|
||||
}
|
||||
}
|
||||
26
src/com/ing/zoo/Zebra.java
Normal file
26
src/com/ing/zoo/Zebra.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package com.ing.zoo;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Zebra {
|
||||
public String name;
|
||||
public String helloText;
|
||||
public String eatText;
|
||||
public String trick;
|
||||
|
||||
public Zebra()
|
||||
{
|
||||
}
|
||||
|
||||
public void sayHello()
|
||||
{
|
||||
helloText = "zebra zebra";
|
||||
System.out.println(helloText);
|
||||
}
|
||||
|
||||
public void eatLeaves()
|
||||
{
|
||||
eatText = "munch munch zank yee bra";
|
||||
System.out.println(eatText);
|
||||
}
|
||||
}
|
||||
38
src/com/ing/zoo/Zoo.java
Normal file
38
src/com/ing/zoo/Zoo.java
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package com.ing.zoo;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Zoo {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
String[] commands = new String[4];
|
||||
commands[0] = "hello";
|
||||
commands[1] = "give leaves";
|
||||
commands[2] = "give meat";
|
||||
commands[3] = "perform trick";
|
||||
|
||||
Lion henk = new Lion();
|
||||
henk.name = "henk";
|
||||
Hippo elsa = new Hippo();
|
||||
elsa.name = "elsa";
|
||||
Pig dora = new Pig();
|
||||
dora.name = "dora";
|
||||
Tiger wally = new Tiger();
|
||||
wally.name = "wally";
|
||||
Zebra marty = new Zebra();
|
||||
marty.name = "marty";
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.print("Voer uw command in: ");
|
||||
|
||||
String input = scanner.nextLine();
|
||||
if(input.equals(commands[0] + " henk"))
|
||||
{
|
||||
henk.sayHello();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Unknown command: " + input);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in a new issue