1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
UkoKoshka [18]
3 years ago
6

Create an application that contains an enumeration that represents the days of the week. Display a list of the days, and then pr

ompt the user for a day. Display business hours for the chosen day. Assume that the business is open from 11 to 5 on Sunday, 9 to 9 on weekdays, and 10 to 6 on Saturday. Save the file as DayOfWeek.java.

Computers and Technology
1 answer:
IgorLugansk [536]3 years ago
7 0

Answer:

The program to this question can be defined as below:

Program:

import java.util.*; //import package for user input

enum Days{Sunday, Monday, Tuesday, Wednesday, Thusday, Friday, Saturday} //defining enum

public class DayOfWeek //defining class DayOfWeek

{

  public static void main(String[] args) //defining main method

  {

  System.out.println("Days of the Week: "); //print message  

  for (Days d : Days.values()) //defining for loop to print enums values

  {

  System.out.print(d+"\n");//print values

  }

  System.out.println("Enter your day: "); //print message

  Scanner obx= new Scanner(System.in); //create Scanner class object for user input

  Object d= obx.next(); //create object to hold user-input value

  System.out.print("Business Hours "); //print message

   //check conditions  

  if(Days.Sunday.toString().equals(d)) //defining if block to check if day is Sunday

  {

  System.out.println("from 11 to 5"); //print message

  }

  else if(Days.Saturday.toString().equals(d))// check if the day isn't Sunday

  {

  System.out.println("from 10 to 6");  //print message

  }

  else //else block

  {

      System.out.println("from 9 to 9");//print message

  }

  }

}

Output:

please see the attachment.

Explanation:

In the given code first package is import for user input then the enumeration "Days" is used, in which weekday values are defined. In the next line, the class "DayOfWeek" is defined, in this main method is declared, that first uses a loop to print enum value than it will create object "d" for user input and define conditional statement to check values, that can be described as follows:

  • In the if block it will check if the input value is "Sunday", it will print 11 to 5 business hours, otherwise, it will go to the else if block.
  • In this block it will check, that input value is "Saturday", if it is true it will print 10 to 6 business hours.
  • If both above condition is false so, it will print 9 to 9 business hours.

You might be interested in
Antivirus software products require that you update _____ on a regular basis
horrorfan [7]
Operating System

Not much context for this questiom but that should be right.
7 0
3 years ago
Read 2 more answers
write ms-dos command to list all the files and folders of EIGHT sub directory of C: drive in ascending order according to file n
Anna007 [38]

The dir command displays information about files and directories, and how much disk space is available. By default, it displays the name, size, and last modification time of every file in the current directory.

7 0
3 years ago
Refer to the color wheel to identify the color scheme.
morpeh [17]
C) monochromatic
Hope this helps!

btw make me brainliest?
4 0
4 years ago
What are some benefits of web-based applications?
Marina86 [1]

You get results faster

4 0
3 years ago
Read 2 more answers
What term describes a wireless network topology in which access points work as peer devices on the same network?
kumpel [21]
Mesh WLAN wireless mesh network WMN describes a wireless network topology in  access points work as peer devices on the same network.
<span />
7 0
3 years ago
Other questions:
  • Your game design company has recently asked all employees to use a specific personal information management application (PIM) to
    6·1 answer
  • In which file format is image data compiled into a binary file? TIFF SVG CGM BMP
    11·1 answer
  • Which is a correct way to test whether two variables representing numbers, numOne and numTwo, are equal?
    8·1 answer
  • In C++ Please :
    6·1 answer
  • Jason is driving 1,050 miles from Miami, Florida, to New
    15·1 answer
  • Solid state components are less likely to fail because they:______.a. are driven by precise sets of software instructions. b. ha
    8·1 answer
  • Which of the following is a separate summary worksheet in the same workbook?
    14·1 answer
  • To use appropriate personal protective equipment we should​
    12·1 answer
  • Choose the best function for the purpose.
    11·1 answer
  • state how to transfee information from website to el processing document in computers and technology.​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!