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
Consider ________ when designing for display on a mobile device. font size all of these contrast small screen size
Delvig [45]
To be honest...i really dont know 
6 0
3 years ago
Read 2 more answers
Assume a computer uses pipelining of 9 stages. Each stage demands 3 clock cycles to finish its task. How many clock cycles are n
serg [7]

Answer:

Explanation:

b) Each stage requires one clock cycle; ... Calculate how many clock cycles will take execution of this segment on the regular (non- pipelined) ... Instruction. Clock cycle number . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... It is possible ... It means that all stages of 5-stage pipeline are always busy (no stalls) during the task.

8 0
2 years ago
Give five examples of top level domain​
coldgirl [10]

Answer:  .com — Commercial businesses.

.org — Organizations (generally charitable).

.net — Network organizations.

.gov — U.S. government agencies.

.mil — Military.

.edu — Educational facilities, like universities.

Explanation:

5 0
2 years ago
Read 2 more answers
Technician A says that generic scan tools must be able to read all generic OBD-II codes. Technician B says that all generic scan
Likurg_2 [28]

Answer:

A. Technicians A and B

Explanation:

When we're talking about generic scanners and about all OBD-II codes, in this case, both technician A and B is the correct answer. Because we can scan all OBD-II codes with a generic scan.

But the technician A just says generic tools must be able to read all generic OBD-II codes and technicians B just says generic scan tools must be able to read manufacture OBD-II code, both are correct.

4 0
3 years ago
Lisa and her husband would like to buy a house soon. She continuously pays bills late. How do her actions affect her and others?
stiks02 [169]
Well actually it affects her credit. Home owners would not want to sell a house to someone who doesn't pay bills on time. It shows he/she is unreliable

3 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following rules should be used to keep the appropriate distance between your vehicle and the vehicle in front of yo
    10·2 answers
  • An athlete runs every day for five days. Write a program that computes the total distance and average distance ran by the athlet
    10·1 answer
  • What are the features of a strong résumé? Check all that apply.
    7·1 answer
  • What is the name of the technology that is typically implemented on switches to avoid Ethernet connectivity problems when the wr
    11·1 answer
  • i need to also do a algorithm where if the total is a even number 10 points are added to the score and if the total is odd then
    11·1 answer
  • Given a String variable named sentence that has been initialized, write an expression whose value is the number of characters in
    13·1 answer
  • Write a Java program that generates GUI (Graphical User Interface). Your program should provide labels and textfields to a user
    9·1 answer
  • Who distributes IP Address?
    10·1 answer
  • - Consider the relation R = {A, B, C, D, E, F, G, H, I, J} and the set of functional dependencies F = { {B, C} -&gt; {D}, {B} -&
    14·1 answer
  • In a blockchain, each block has a unique hash value which is dependent on the hash value of the previous block in the chain. Wha
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!