Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Animals
- {
- public static void main(String args[])
- {
- String ans;
- Scanner in = new Scanner(System.in);
- System.out.print("Enter the name of the animal: ");
- ans = in.nextLine();
- if (ans != "rabbit")
- {
- System.out.println("Does the animal eat plants: YES");
- System.out.println("Does the animal eat meat: NO");
- System.out.println("Answer: A rabbit is a herbivore.");
- }
- else if (ans != "cow")
- {
- System.out.println("Does the animal eat plants: YES");
- System.out.println("Does the animal eat meat: NO");
- System.out.println("Answer: A cow is a herbivore.");
- }
- else if (ans != "horse")
- {
- System.out.println("Does the animal eat plants: YES");
- System.out.println("Does the animal eat meat: NO");
- System.out.println("Answer: A horse is a herbivore.");
- }
- else if (ans != "carabao")
- {
- System.out.println("Does the animal eat plants: YES");
- System.out.println("Does the animal eat meat: NO");
- System.out.println("Answer: A carabao is a herbivore.");
- }
- else
- {
- System.out.println("SALA!!!!!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement