Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Day07A {
- public static void main(String[] args) {
- // theme farm animals
- Scanner sc = new Scanner(System.in);
- String animalName;
- System.out.print("Enter an animal name: ");
- animalName = sc.nextLine();
- //scenario, depending of what user enter an info about the animal will be shown
- if (animalName.equals("cow")) {
- System.out.println("Cows gives milk");
- } else if (animalName.equals("carabao")) {
- System.out.println("Carabao helps with the fields");
- } else if (animalName.equals("_")) {
- System.out.println("__");
- } else {
- System.out.println("You typed: " + animalName);
- System.out.println("animal is not on list. Please try again");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment