/home/caleb/ASDV-Java/lab8_CalebFontenot/src/main/java/com/calebfontenot/lab8_calebfontenot/Switch4.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package com.calebfontenot.lab8_calebfontenot;
import java.util.Scanner;
public class Switch4 {
public static void main(String[] args) {
String dayOfWeekString = "Nullday",
ordinal = "0th";
Scanner input = new Scanner(System.in);
System.out.print("Enter a day of the week (Case-Sensitive): ");
dayOfWeekString = input.next();
switch (dayOfWeekString) {
case "Sunday":
ordinal = "1st";
break;
case "Monday":
ordinal = "2nd";
break;
case "Tuesday":
ordinal = "3rd";
break;
case "Wednesday":
ordinal = "4th";
break;
case "Thursday":
ordinal = "5th";
break;
case "Friday":
ordinal = "6th";
break;
case "Saturday":
ordinal = "7th";
break;
}
System.out.println(dayOfWeekString + " is the " + ordinal + " day of the week.");
}
}