Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA 1. Enumerations [5 points]: Create an enumeration called DaysOfWeek for representing the days of the week. Add an integer field to associate a numeric

JAVA

image text in transcribedimage text in transcribed

1. Enumerations [5 points]: Create an enumeration called DaysOfWeek for representing the days of the week. Add an integer field to associate a numeric value with the corresponding day (you will assign 1 to MONDAY, 2 to TUESDAY, ..., 7 to SUNDAY) * * Add a constructor method that will set that field. Add a parameters list to each listed value to use a constructor method definition that you just added. Add a getter method for your field. - 2. Command-line arguments [10 points]: A frequent need in many computer applications is to be able to compute the day of the week that a Gregorian calendar date falls on, given a month, day, and year. Most programming languages include functions to perform these calculations already, but you will write the calculations yourself to see how basic arithmetic and decisions are performed in Java. You will implement a computation called Zeller's congruence, developed by German mathematician Christian Zeller (1822-1899), which can compute the day of the week given a month, day of the month, and year Create a new class called PerpetualCalendar * " T his program should take exactly three command-line arguments: one representing the month (1-January, 2- February, etc.), one representing the day of the month, and one representing the (four-digit) year, in that order. Declare variables to hold these values and then convert the values that have been read from the command-line to ntegers Zeller realized that the February 29th leap day would cause problems in his calculations, since it is sandwiched in the middle of the calendar year. To get around this, he devised a clever trick: instead of treating January and February as the Ist and 2nd months of the year, he would treat them as the 13th and 14th months of the previous year. This would make February 29th, if it occurred, the final day of his calendar year! So, we need to modify our month and year variables. If the month is January, set the month to be 13 and subtract one from the year. Ifthe month is February, set the month to be 14 and subtract one from the year. In all other cases, we want to leave the month and year as they are * Now it's time to compute the first part of Zeller's congruence. The first part of the formula is 26(m +1) 100JL400

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions

Question

Explain the cost of capital.

Answered: 1 week ago

Question

Define capital structure.

Answered: 1 week ago

Question

List out some inventory management techniques.

Answered: 1 week ago

Question

2. What recommendations will you make to the city council?

Answered: 1 week ago

Question

3. The group answers the questions.

Answered: 1 week ago