Saturday, April 30, 2016

URI 1049 Solution in Java language || Animal



URI Online Judge | 1049

Animal

By Neilor Tonin, URI  Brazil
Timelimit: 1
In this problem, your job is to read three Portuguese words. These words define an animal according to the table below, from left to right. After, print the chosen animal defined by these three words.

Input

The input contains 3 words, one by line, that will be used to identify the animal, according to the above table, with all letters in lowercase.

Output

Print the animal name according to the given input.
Input SamplesOutput Samples
vertebrado
mamifero
onivoro
homem
vertebrado
ave
carnivoro
aguia
invertebrado
anelideo
onivoro
minhoca


URI 1049 Solution in Java language || Animal

import java.io.IOException;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {

        String A, B, C;
Scanner input =new Scanner(System.in);
A = input.next();
B = input.next();
C = input.next();

if (A.equals("vertebrado")  && B.equals("ave") && C.equals("carnivoro")) {
System.out.print("aguia\n");
}
if (A.equals("vertebrado") && B.equals("ave") && C.equals("onivoro")) {
System.out.print("pomba\n");
}
if (A.equals("vertebrado") && B.equals("mamifero") && C.equals("onivoro")) {
System.out.print("homem\n");
}
if (A.equals("vertebrado") && B.equals("mamifero") && C.equals("herbivoro")) {
System.out.print("vaca\n");
}
//-----------------------------------------------------------------

if (A.equals("invertebrado") && B.equals("inseto") && C.equals("hematofago")) {
System.out.print("pulga\n");
}
if (A.equals("invertebrado") && B.equals("inseto") && C.equals("herbivoro")) {
System.out.print("lagarta\n");
}
if (A.equals("invertebrado") && B.equals("anelideo") && C.equals("hematofago")) {
System.out.print("sanguessuga\n");
}
if (A.equals("invertebrado") && B.equals("anelideo") && C.equals("onivoro")) {
System.out.print("minhoca\n");
}

    }

}

No comments:
Write comments

To know more about the problem, give us your valuable commment. We'll try to help you. Thanks

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.