Answer :
Answer:
import java.util.Scanner;
public class num5 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Who was the murderer?");
String suspectName = in.next().toUpperCase();
if(suspectName.equals("AMOS")){
System.out.println("It was Amos with the candlestick!");
}
else if (suspectName.equals("KEVIN")){
System.out.println("It was Kevin with the revolver!");
}
else if (suspectName.equals("JUAN")){
System.out.println("It was Juan with the lead pipe!");
}
else{
System.out.println("We're not sure who that is. We need to investigate further");
}
}
}
Explanation:
The solution is implemented in Java
Scanner class is used to prompt and receive user's input saved into the variable suspectsName
Using if and else statements, we display the appropriate response as specified in the question.