Explanation of Solution
Program:
File name: “DayOfWeek.java”
//Import necessary header files
import java.util.Scanner;
//Define a class named DayOfWeek
public class DayOfWeek
{
//Define an enumerated data type
enum Day {SUN, MON, TUE, WED, THU, FRI, SAT};
//Define main method
public static void main(String[] args)
{
//Declare the variables
Day day;
String userEntry;
int position;
int comparison;
//Declare a string of objects
String[] times = {"11 - 5", "9 - 9", "10 - 6"};
//Create an object for the Scanner class
Scanner input = new Scanner(System.in);
//Print the result
System.out.println("The days are:");
for(Day d : Day.values())
System.out.print(d + " ");
/*Prompt the user to enter the day code to find the business hours for the chosen day*/
System.out.print("\n\nEnter the day code to find our hours >> ");
userEntry = input...
Trending nowThis is a popular solution!
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage