- 1

Hot to solve emotion detector

Java

5th Aug 2022, 3:22 AM
Mommy
Mommy - avatar
4 Réponses
+ 6
You are spaces between 'are' and 'surprised'. An Indeed, it's 'surprised', not 'suprised'😉 Copy to be sure System.out.print("You are surprised!");
5th Aug 2022, 6:11 AM
Roland
Roland - avatar
+ 3
switch(emotion){ case 1: System.out.print("You are happy!"); break; case 2: System.out.print("You are sad!") ; break; case 3: System.out.print("You are angry!"); break; case 4: System.out.print("You are suprised!"); break; default: System.out.print("Unknown emotion."); } } }
5th Aug 2022, 3:22 AM
Mommy
Mommy - avatar
+ 2
I think you just missed one 'r' letter in case 4, its "surprised" not "suprised". Even something this simple can fail us in such tasks, the point is to be more thoroughly observant about what our code should output ...
5th Aug 2022, 3:55 AM
Ipang