answer.
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
agasfer [191]
1 year ago
13

Create an enumeration named Month that holds values for the months of the year. With JANUARY equal to 1, FEBRUARY equal to 2, an

d so on through DECEMBER equal to 12. Write a program named MonthNames that prompts the user for a month integer. Convert the user’s entry to a Month value, and display it. Make sure your integer prompt message does not contain any month names (January, etc.) as this will cause the tests to fail! For Example: "Enter a month number >> " does not contain month names and will work properly.
Computers and Technology
1 answer:
maria [59]1 year ago
4 0

Answer:

import java.util.Scanner;

public class Question {    

   public enum Months{

       JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER

   }

   public static void main(String args[]) {

     

     Scanner scan = new Scanner(System.in);

     System.out.println("Enter a month number>>: ");

     int inputNumber = scan.nextInt();

     

     if(inputNumber > 12 || inputNumber < 1){

         System.out.println("Please enter a valid number.");

     } else {

         System.out.println(Months.values()[inputNumber - 1]);

     }

   }

}

Explanation:

The import statement at the top of the class is to help us receive user input via the keyboard. The class was defined named "Question". Then the enum was declared listing all the months. Then the main function was declared. The Scanner object was created as scan, then the user is prompted for input which is assigned to inputNumber. The user input is validated to be within the range of 1 - 12; if it is outside the range, the user shown an error message. If the input is correct, the appropriate month is displayed to the user. To get the appropriate month, we subtract one from the user input because the enum class uses the zero-index counting; it start counting from zero.

You might be interested in
E xercise 17.2.4: The following is a sequence of undo-log records written by two transactions T and U: &lt; START T&gt;; ; &lt;
masya89 [10]

Answer:

Check the explanation

Explanation:

The following is a sequence of Undo — log records written by two transactions.

<START 1>; <F, A, 10>; <START U>; <U, B, 20>; <F, C, 30>; <U, D, 40>; <COMMIT U>; <T, E, 50>; <COMMIT T>; (a) < START U >;

If the system crashes after the log < START U >,

Then we have log records will be shown below.

<START U>;

<T, A, 10>;

<START T>;

SYSTEM CRASHED

The recovery manager sees the Undo - Redo log and inspect the both trans-actions T and U are not committed. Then those elements changed by both transactions are arranged to their old values.

  1. Transaction T changes the element A.
  2. Then the Element A is arranged to old value A=10.
  3. Transaction U did not change any existing element in the records.
  4. So, not anything to do with transaction U.

(B) < T, E, 50>;

If the system crashes after the log < T, E, 50>;

Then we have log records will be shown below .

START T>;

<T, A, 10>;

<START U>;

<U, B, 20>;

<T, C, 30>;

<U, D, 40>;

<COMMIT U>;

<T, E, 50>;

SYSTEM CRASHED

The recovery manager sees the Redo logs and inspect the transaction U is committed or not. Such changes made by transaction U are reached to disk.

• So much the recovery manager arranged the elements to their recent values changed by transaction U.

• Transaction U changed the elements B and its records <U, B, 20>with re-cent values.

• Transaction U changed the elements D and its records <U, D, 40>with recent values.

• The transaction T is not committed.

• Then the elements changed by transaction T are arranged to old values.

• Then element A is arranged to 10, C is arranged to 30 and E is arranged to 50.

7 0
2 years ago
Lucas put a lot of thought into the design for his company's new white paper. He made sure to include repeating design elements
Alenkasestr [34]
C. provide consistency
8 0
2 years ago
Read 2 more answers
Modern operating system decouple a process address space from the machine's physical memory. list two advantages of this design.
likoan [24]

The two advantages of modern operating systems is that it has the capacity in helping programs to be loaded faster compared to other older versions and it also has the ability of having to run programs that are large enough in which is in the main memory even if it is smaller compared to the size of its program.

4 0
2 years ago
Please answer this a due tomorrow!!!
dem82 [27]

Answer:  

4-Well first of all for the "VR" problem it could be a problem, because people could forget about there actual life and not be able to much of anything when needed.

1-the first one you are going to have to answer.

2-If you have different files then you aren't stumbling through multiple different links and could have trouble with finding what is needed.

3-the third one you are going to have to answer.

5-If I were you I would help them the best way you could so they can actually know how to do their job.

5 0
1 year ago
Spark is electrical discharge in air, while air is mix of variety of gases what particles conduct electricity in gas
erastova [34]

Answer:

Mercury, rontgen rays, etc.

Explanation:

There are lots of answers to this question, hope these two help.

6 0
1 year ago
Other questions:
  • PLEASE HELP!! WILL GIVE BRAINLIEST!!
    15·2 answers
  • Which item is essential to know before sketching a navigation menu flowchart? template specifics, such as horizontal or vertical
    12·1 answer
  • Why is the following statement true - ideally, your information is abbreviated
    10·2 answers
  • The following parts were ordered by someone building a personal computer:
    12·1 answer
  • For his class project, Matt has to create an image in a color scheme that has shade or tint variations of the same hue. Which co
    7·1 answer
  • Information systems cannot solve some business problems. Give three examples and explain why technology cannot help.
    11·1 answer
  • 1.the following code example would print the data type of x, what data type would that be?
    12·1 answer
  • Write a program that takes a single integer input from the user and stores it in a variable. Your program should increase the va
    15·1 answer
  • Chinh wants to have a program print, "Sorry, but that isn’t one of your options" until the user enters the correct information.
    13·1 answer
  • A group of developers for a startup company store their source code and binary files on a shared open-source repository platform
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!