Question: program is java We will write a program that given any valid date, will then display the day of the week on which the date

 program is java We will write a program that given any

program is java

We will write a program that given any valid date, will then display the day of the week on which the date fell. Your program will prompt the user for a date in the form of a String in the format MM/DD/YYYY Your program must break the string into pieces for the month day and year. Next it must convert the day, month and year into integers and then validate the date (legal day, legal month and legal year). Also only consider dates since the year 1900 If the date is invalid, ie:.. 02/29/2015 your program should print out a message such as: 02/29/2015 is NOT a valid date. If the date is valid use the following formula to calculate the day of the week as an integer between 0 & 6. For example for the date 10/19/2015, would printa message saying The date 10/19/2015 falls on a Monday Note, all variables are integers and the divisions are integer divisions. (14 - month) a = 12 y = year - a m= month + 12 xa-2 daynum = [day+y+ - 136 + 480+ ( 312")) modulo 7 daynum= day + y + 31 * ml modulo 7 12 The month day, and year variables used in the equation are the integer date values (10, 19 and 2015) from the previous example). The final value of daynum is 0-6 with 0 representing Sunday, and 6 representing Saturday. You should write methods to calculate each part of the conversion, and to extract the different parts from the date. Note: Use message and input dialog boxes for all input and output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!