Try The Code Below And I have added toUpperCase so that it can read from user either lowercase and uppercase,
But i can't insert it inside the case monday and i have replace it with int num, so may i know what are the solutions ?
Please comment about my code cause i'm just a beginner in Java
import java.util.Scanner;
public class application {
private static Scanner myMachine;
private static Scanner myMachine2;
public static void main(String[] args) {
myMachine = new Scanner(System.in);
myMachine2 = new Scanner(System.in);
System.out.println("Please Enter The Weekday Of Today: ");
String command = myMachine.nextLine();
command = command.toUpperCase();
switch (command){
case "MONDAY":
System.out.println("Monday is a Working Days !\n");
System.out.println("Are You Feeling Tired Today ?\n");
System.out.println("Answer 1 = Yes\n" + "Answer 2 = No");
int num = myMachine2.nextInt();
if (num == 1){
System.out.println("Ohh So Pity !");
}
else
{
System.out.println("So WORK MORE HARDER !!!!!!!!!!!!");
}
break;
case "TUESDAY":
System.out.println("OMG TUESDAY ARE HORRIBLE!");
break;
case "WEDNESDAY":
System.out.println("HAHA Its Nice Weekdays For You.");
break;
case "THURSDAY":
System.out.println("Ohh Today's Are Weekday !");
break;
case "FRIDAY":
System.out.println("Beware Of Black Friday !");
break;
case "SATURDAY":
System.out.println("Lets Go For Fun Today !");
break;
case "SUNDAY":
System.out.println("Its A Rest Day");
break;
default:
System.out.println("You Have Enter unrecognized command !");
}
}
}