Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class program {
- public static void main(String[] args) {
- // Nikki Forehand
- // March 25, 2019
- int age;
- String name;
- Animal Bella, Sassy , Stella;
- Bella = new Animal();
- Bella.type = "dog";
- Bella.color = "White & Black";
- Bella.eyes = 2;
- Bella.feet = 4;
- Bella.canFly = false ;
- Bella.hair = true;
- Bella.smell= true ;
- Bella.message = "Woof!";
- Bella.speak();
- Sassy = new Animal();
- Sassy.type = " Pig";
- Sassy.color = "Gray";
- Sassy.eyes = 2;
- Sassy.feet = 4 ;
- Sassy.canFly = false;
- Sassy.hair = false;
- Sassy.smell = false ;
- Sassy.message = "Oink!";
- Sassy.speak();
- Stella = new Animal();
- Stella.type = "Ant";
- Stella.color = "Red";
- Stella.eyes = 3;
- Stella.feet = 6 ;
- Stella.canFly = false;
- Stella.hair = false;
- Stella.smell = false;
- Stella.message = "Chirp!";
- Stella.speak();
- }
- }
- class Animal {
- String type;
- String color;
- int feet;
- int eyes;
- boolean canFly;
- boolean hair;
- boolean smell;
- String message;
- public void speak() {
- System.out.println(message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement