Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //*Mattie Richardson
- //* 3/26/19
- //* 4th Period
- //*Computer Science
- public class Program {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int age;
- String name;
- Animal bob, sue, lily, moe, milly;
- bob = new Animal (); // Names of animals
- sue = new Animal ();
- lily = new Animal ();
- moe = new Animal ();
- milly = new Animal ();
- //type of animal, features, and noise it makes
- bob.type = "cow";
- bob.color = "brown";
- bob.feet = 4;
- bob.canFly = false;
- bob.message = "moo";
- bob.speak();
- sue.type = "cat";
- sue.color = "black";
- sue.feet = 4;
- sue.message = "meow";
- sue.speak();
- lily.type = "goat";
- lily.color = "white";
- lily.feet = 4;
- lily.canFly = false;
- lily.message = "bahaha";
- sue.speak();
- moe.type = "pig";
- moe.color = "pink";
- moe.feet = 4;
- moe.message = "oink";
- moe.speak();
- milly.type = "donkey";
- milly.color = "brown";
- milly.feet = 4;
- milly.message = "e-aah";
- milly.speak();
- }
- }
- class Animal {
- String type;
- String color;
- int feet;
- boolean canFly;
- String message;
- public void speak() {
- System.out.println(message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement