I need help to debug this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need help to debug this code

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int emotion = scanner.nextInt(); /* 1 - "You are happy!" 2 - "You are sad!" 3 - "You are angry!" 4 - "You are surprised!" other - "Unknown emotion." */ switch (emotion ) { case 1: System.out.println("You are happy!"); break; case 2: System.out.println ("You are sad!"); break; case 3: System.out.println("You are angry!"); break; case 4: System.out.println("You are suprised!"); break; default: System.out.println("Unknown emotion."); } // your code goes here } }

4th Jun 2022, 9:40 PM
Amofah Bright
2 Answers
+ 2
I found two problems: 1. You posted a wall of code in the question description, instead of a link to this code in Code Playground 2. You didn't give the slightest hint of the problem you saw and need to debug
4th Jun 2022, 11:54 PM
Emerson Prado
Emerson Prado - avatar
0
what’s wrong with it?
4th Jun 2022, 11:38 PM
Dallas Griffith
Dallas Griffith - avatar