Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package animals;
- public class Goat
- {
- private static String name;
- private static String color;
- private static int legs;
- private static boolean tail;
- private static String travel;
- private static String sound;
- public static String setName()
- {
- name = "Billy";
- return name;
- }
- public static String setColor()
- {
- color = "White";
- return color;
- }
- public static int setLegs()
- {
- legs = 4;
- return legs;
- }
- public static boolean setTail()
- {
- tail = true;
- return tail;
- }
- public static String setTravel()
- {
- travel = "Walk";
- return travel;
- }
- public static String setSound()
- {
- sound = "Bleat";
- return sound;
- }
- public void writeOutput()
- {
- setName();
- setColor();
- setLegs();
- setTail();
- setTravel();
- setSound();
- System.out.println("Name: " + name);
- System.out.println("Color: " + color);
- System.out.println("How many legs: " + legs);
- System.out.println("Tail? " + tail);
- System.out.println("Locomotion Method: " + travel);
- System.out.println("Sound Made: " + sound);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement