Professional Documents
Culture Documents
Object-Oriented Programming
BSIT – 303 07 Hands-on Activity 1
package runanimal;
/**
* @author Earvin
*/
import java.util.Scanner;
System.out.print("Choose an animal. Press B for Bird, C for Cat, or D for Dog: ");
if(Chosen.equalsIgnoreCase("B")){
bird.eat();
bird.sleep();
bird.makeSound();
else if(Chosen.equalsIgnoreCase("C")){
cat.eat();
cat.sleep();
cat.makeSound();
else if(Chosen.equalsIgnoreCase("D")){
dog.eat();
dog.sleep();
dog.makeSound();
else {
System.out.println("Wrong Input!");
void eat() {
void sleep() {
void makeSound() {
System.out.println("Tweet tweet!");
}
void eat() {
void sleep() {
void makeSound() {
System.out.println("Meow meow!");
void eat() {
void sleep() {
void makeSound() {
System.out.println("Arf arf!");
}
OUTPUT: