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
agasfer [191]
3 years 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]3 years 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
What stage of software development incorporates planning to help make changes in the project plan based of reviews
larisa86 [58]

Answer:

A

Explanation:

8 0
3 years ago
Online, it is easy to think of communication as “computer to ____________” rather than “_________ to ___________”.
KiRa [710]
I would say D but if not I’m terribly sorry

Hope this helps

Have a great day/night
7 0
3 years ago
Read 2 more answers
Susan needs to change the color scheme in all the slides of her multimedia presentation. The presentation software program Susan
siniylev [52]
I believe this would be C, B, A, D
Sorry if it wasn’t.
4 0
3 years ago
Read 2 more answers
When reading words using a Scanner object's next method, _________. a. any characters at the beginning of the input that are con
zavuch27 [327]

Answer:

The answer is "Option d"

Explanation:

The scanner method is the full token of the process, that finds and returns. It is token, which is followed by both the inputs meeting and the guideline template. This method can block, even though the former instance of hasNext() is true while waiting for input, and wrong choices can be described as follows:

  • In option a, It is incorrect because the character at the beginning can't be considered.
  • In option b, It is wrong because the characters are known as the word in which blank space not a part of the word.
  • In option c, It is wrong because in this input before the call is not the method.
3 0
3 years ago
Privacy a. is an absolute value so corporate interests cannot be considered when it comes to employee privacy. b. is guaranteed
zmey [24]

Answer:

C. Must be respected if we are to function as complete, self-governing agents.

Explanation:

<em>Privacy</em> is the boundaries that are set up to protect us against unwanted intrusion or interference, and it forms the basis of our interaction with the world.

<em>Privacy laws</em> are set-up to protect individuals from unwanted and unapproved access to privacy by individuals, organizations, and government. This is greatly adhered to in many countries.

To some extent, privacy is considered to overlap with security, because, when private information such as social security number, bank card details, account names, and details, etc. are accessed inappropriately, the individual's security is greatly compromised.

Therefore, privacy must be greatly respected if we are to function as complete, self-governing agents.

8 0
3 years ago
Other questions:
  • Write a method called multiconcat that takes a string and an integer as parameters. return a string that consists of the string
    6·1 answer
  • What are career resources?
    7·2 answers
  • How to change font size and style and add a table when creating a webpage?
    6·1 answer
  • What is a series of instructions or commands that a computer follows used to create software
    9·1 answer
  • _____ is a component of a data model that defines the boundaries of a database, such as maximum and minimum values allowed for a
    12·1 answer
  • Write program statements to determine the fewest number of bills needed to represent a total dollar amount.
    11·1 answer
  • What year did Elvis die? Right answer 1977.
    14·1 answer
  • There are six different sequences for the three approval tasks: check inventory; check credit; check special terms.
    5·1 answer
  • What are cell phones used for?
    8·2 answers
  • What are the benefits and drawbacks of a desktop utilising virtualisation and a server?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!