Implement an Enum in Java which enumerates the months of the year. Include in the enum the relevant position of the month in the calender i.e. Jan = 1, Feb = 2, etc and the number of days in the month i.e. Jan = 31, Feb = 28, etc. You do not need to provide support for leap years in the implementation. Provide a suitable toString() method to print information about the enumerated types.
Thanks for the question.
Below is the code you will be needing Let me know if you have any doubts or if you need anything to change.
Thank You !
===========================================================================
public enum Month {
Jan(1, 31), Feb(2, 28), Mar(1, 31),
Apr(4, 30), May(5, 31), Jun(6, 30),
Jul(7, 31), Aug(8, 31), Sep(9, 30),
Oct(10, 31), Nov(11, 30), Dec(12, 31);
private final int monthIndex;
private final int days;
private Month(int month, int days) {
monthIndex = month;
this.days = days;
}
@Override
public String toString() {
return name()+" = " + monthIndex + ", Days = " + days;
}
public static void main(String[] args) {
Month jan = Month.Jan;
System.out.println(jan);
Month nov = Month.Nov;
System.out.println(nov);
}
}
===================================================================

Implement an Enum in Java which enumerates the months of the year. Include in the enum...
C++ Write a program that illustrates enumeration types. Define an enumeration type for the months of the year. This should be global. Put it above the main program. Declare a variable of the enumerated type called month; Declare an array of unsigned integers called year[12] and initialize the array to the days in each month. (Just assume 28 for February.) 1. Write a loop that will progress from January through December printing out the days in each month. The index...
Please write a C program to implement the calendar of the year (after the year 1900) you specify. For example, when you input 1900, the program print the calendar of year 1900 as the figure (partial) down below. Hint 1: Jan. 1st, 1900 is Monday. Hint 2: You will need to consider the case of Leap Year where there are 29 days in the month of February. In common years there are 28 days in the month of February. For...
Use Java please
Creating a calendar for a given year A shell for this assignment has been provided so that you can fill in the methods Homework 4 grading rubric 1. Output examples a. One Normal Year, 10% b. One Leap Year, 10% 2. Style Meaningful variable names, 10% b. Meaningful method names, 10 % c. Comments, Total: 10% . Do not comment every line. 5% . Comment non-obvious code. 5% a d. Indentation, 10% e. Block comment with name...
In Java You are to write a program that determines the day of the week for New Year's Day in the year 3000. To do this, you must create your own date class (MyDate) and use the following interface and main program: /** Interface for Date objects to be used by the Year3000 driver program. @author Jon Sorenson */ public interface DateInterface { /** @return the day of the month (1-31) */ public int getDay(); /** @return the day of...
Description: This project focuses on creating a Java class, Date.java, along with a client class, DateCleint.java, which will contain code that utilizes your Date.java class. You will submit both files (each with appropriate commenting). A very similar project is described in the Programming Projects section at the end of chapter 8, which you may find helpful as reference. Use (your own) Java class file Date.java, and a companion DateClient.java file to perform the following: Ask user to enter Today’s...
please write code in java and comment. thanks. the program is about interface . Implement the basics of Fitness and types of Fitness: Aerobic. Implement specific Fitness types such as Swimming, Cycling, Fitness Task: public interface Fitness (10pts) This will be used as a starting point for deriving any specific Fitness type. Every fitness exercise type has one or more muscle group it affects. Therefor a Fitness has the following abstarct method (Note that all methods in an interface are...
A bounded string list has an upper limit on its size, which is set when the list is created. The size limit specifies the maximum number of strings that can be stored in a bounded string list. String lists are mutable and allow random accesses to their elements using indexes. The list operations include BoundedStringList(int sizeLimit); void insert(String newString, int index); void delete(int index); String get(int index); The constructor creates an empty list with a maximum size of sizeLimit. The...
Description: This project focuses on creating a Java class, Date.java, along with a client class, DateCleint.java, which will contain code that utilizes your Date.java class. You will submit both files (each with appropriate commenting). A very similar project is described in the Programming Projects section at the end of chapter 8, which you may find helpful as reference. Use (your own) Java class file Date.java, and a companion DateClient.java file to perform the following: Ask user to enter Today’s...
I need to create a Java class file and a client file that does the following: Ask user to enter Today’s date in the form (month day year): 2 28 2018 Ask user to enter Birthday in the form (month day year): 11 30 1990 Output the following: The date they were born in the form (year/month/day). The day of the week they were born (Sunday – Saturday). The number of days between their birthday and today’s...
Programming Assignment 1 Data structure Java Implement Shellsort for a linked list, based on a variant of bubble sort. The rather severe constraints imposed by the singly-linked list organization presents special problems for implementing Shellsort. Your task is to overcome these constraints and develop a simple, elegant implementation that does not sacrifice efficiency or waste space. Step 1. First, implement a routine to build a list: read integers from standard input, and build a list node for each item consisting...