0

Jungle camping challenge

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner input = new Scanner(System.in); String noises =input.nextLine(); char arr [] = noises.toCharArray(); for (int c= 0 ; c <= 3; c++){ if (c==0) System.out.print("Lion"); else if (c==1) System.out.println("Tiger"); else if (c==2) System.out.println("Snake"); else if (c==3) System.out.println("Bird"); } } } I feel like i am close but i only end up outputting each animal

14th Dec 2020, 5:20 PM
Ben Szydlowski
3 Antworten
0
What exactly you want to output and what is the input like(nunber,word,sentence)
16th Dec 2020, 11:49 PM
Julian Bents
Julian Bents - avatar
0
Julian Bents input is a word (grr, Ssss, Chirp, Rawr) and the output is which animal makes each noise (Lion,Bird, etc) but it inputs as "Grr Chirp Rawr" and the output would be Lion Bird Tiger
17th Dec 2020, 7:11 PM
Ben Szydlowski
0
Ben Szydlowski i made some code with a hashmap where you can easily add animals with noises https://code.sololearn.com/cRkeXs0O1SCz/?ref=app
17th Dec 2020, 7:34 PM
Julian Bents
Julian Bents - avatar