Hi I need help finding a way to list these species as valid and any other input invalid. If you need any extra resources let me know! System.out.println("Enter monkey's species: "); String species = scanner.nextLine(); //Validation of species if(species.equalsIgnoreCase("Capuchin")) && !, (species.equalsIgnoreCase("Guenon"))&& ! (species.equalsIgnoreCase("Macaque")) && ! (species.equalsIgnoreCase("Marmoset")) && ! (species.equalsIgnoreCase("Squirrel Monkey")) && ! (species.equalsIgnoreCase("Tamarin"))) { System.out.println("\n\nThis monkey's species is not allowed\n\n"); return; //returns to menu }
Hi I need help finding a way to list these species as valid and any other input invalid. If you need any extra resources let me know!
System.out.println("Enter monkey's species: ");
String species = scanner.nextLine();
//Validation of species
if(species.equalsIgnoreCase("Capuchin")) && !,
(species.equalsIgnoreCase("Guenon"))&& !
(species.equalsIgnoreCase("Macaque")) && !
(species.equalsIgnoreCase("Marmoset")) && !
(species.equalsIgnoreCase("Squirrel Monkey")) && !
(species.equalsIgnoreCase("Tamarin"))) {
System.out.println("\n\nThis monkey's species is not allowed\n\n");
return; //returns to menu
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps