+ 2

I need help with 15.2 practise - emotion detector

My code cannot pass Test case # 5. I don't know what I'm doing wrong, I did it myself and still had trouble with case # 5. Then I rewrote the code from the answer and it's still the same. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int emotion = scanner.nextInt(); 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."); } } }

1st Apr 2022, 7:12 PM
Szymon Grzelak
Szymon Grzelak - avatar
3 Answers
+ 3
The code is fine but you wrote surprised wrong
1st Apr 2022, 9:41 PM
S0ryIHasLag
S0ryIHasLag - avatar
+ 1
Oh my god I thought about it for so long and it was about this ... I looked at this code several times and never noticed it, thank you very much.
1st Apr 2022, 11:30 PM
Szymon Grzelak
Szymon Grzelak - avatar