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
3 odpowiedzi
0
What exactly you want to output and what is the input like(nunber,word,sentence)
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
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