Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write code using Java. I appreciate the help! Write a program that will prompt the user for a date and determine its validity. If
Please write code using Java. I appreciate the help!
Write a program that will prompt the user for a date and determine its validity. If the date is invalid, an error message should be displayed explaining precisly where the error is. If the date is valid, the program should compute the day of the year. Computing the number of days in February During leap years, there are 29 days in February. During non-leap years, there are exactly 28 days. To be a leap year, the year must be evenly divisible by 4. However, not all years evenly divisible by 4 are leap years. Years whose last two digits are zero are century years, for examble, 1800, 1900, and 2000 are century years. Century years are leap years only if they are evenly divisible by 400. The years 1600 and 2000 are leap years. 1700, 1800, and 1900 are not leap years. Sample run number 1: Please enter a date (mm dd yyyy): 13 1 2001 This date has an error! 13 is an invalid month. Example run number 2: Please enter a date (mm dd yyyy): 3 12 3012 This is 3-12-3012 and is day number 72 of the leap year 2012. Example run number 3: Please enter a date (mm dd yyyy): 2 29 2002 The day 2-29-2002 is invalid. There are only 28 days in February during non-leap yearsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started