runanimal

import java.util.Scanner;

interface IAnimalActions {
    String makeSound();
    String eat();
    int getAverageAge();
}

abstract class Animal implements IAnimalActions {
    // Any shared characteristics and methods of animals can be placed here
}

class Bird extends Animal {
    public String makeSound() {
        return "Tweet-tweet!";
    }

    public String eat() {
        return "Grain";
    }

    public int getAverageAge() {
        return 5;
    }
}

class Cat extends Animal {
    public String makeSound() {
        return "Meow";
    }

    public String eat() {
        return "Fish";
    }

    public int getAverageAge() {
        return 15;
    }
}

public class RunAnimal {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Choose an animal (B for Bird, C for Cat): ");
        String choice = scanner.nextLine();

        Animal selectedAnimal = null;

        if ("B".equalsIgnoreCase(choice)) {
            selectedAnimal = new Bird();
        } else if ("C".equalsIgnoreCase(choice)) {
            selectedAnimal = new Cat();
        }

        if (selectedAnimal != null) {
            System.out.println("Sound: " + selectedAnimal.makeSound());
            System.out.println("Food: " + selectedAnimal.eat());
            System.out.println("Age: " + selectedAnimal.getAverageAge());
        } else {
            System.out.println("No such animal found!");
        }
        
        scanner.close();
    }
}