Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java Exercise: Please only use the formula given, no new classes , no other java classes other from string, scanner and math, use arraylist. can

java Exercise:

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Please only use the formula given, no new classes , no other java classes other from string, scanner and math, use arraylist. can use additional methods but keep at fundamental java only for program code and can use supporting methods, and additional enums. And comments thanks.

Here is main already done please do use the main I gave to do it if possible:

public class MyCalendar {

private MyDate myDate;

public static void main(String[] args) {

// TODO code application logic here

while (!validDate){

system.out.print( "enter....");

Mydate enteredDate = new MyDate(input.nextint(), input.nextint(), input.nextint());

if(enteredDate.isValidDate()){

MyCalender myCalender = new Mycalender(enteredDate);

myCalender.printDateinfo();

myCalender.printCalender();

validDate = true;

}

else {

system.out.println("...");

}

}

}

For a given date, we can use the Gregorian calendar to find the corresponding the day of the week, and the week of the month. For example, 19 October 2018 is a Friday and locates in the third week of October 2018 you should use the following formula (Zeller's congruence) to calculate the day of a week for any given date after 15 October 1582 13(m +1) +K5Jmod 7, where . h is the day of the week (0-Saturday, 1- Sunday, 2 -Monday, 3-Tuesday, 4-Wednesday, 5-Thursday, 6- Friday) q is the day of the month . m is the month (3-March, 4-April, 5-May, 6-June, 7-July, 8-August, 9-September 1 1S 10-October, 11=November, 12-December, 13-January, 14= February) .K is the year of the century (year mod 100) Jis the zero-based century (year 100). For example, the zero-based centuries for 1995 and 2000 are 19 and 20 respectively NOTE: In this formula January and February are counted as months 13 and 14 of the previous year e.g. if it is 2 February 2010, the algorithm counts the date as the second day of the fourteenth month of 2009 For example, for 1 January 2000, the date would be treated as the 13th month of 1999, so the values would be: q=1, m=13. K-99,-19, so the formula evaluates as

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Explain the various techniques of training and development.

Answered: 1 week ago

Question

Explain the various techniques of Management Development.

Answered: 1 week ago