Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedPlease 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 years

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

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

Find x such that the distance between (3, 5) and (x, 7) is 13.

Answered: 1 week ago

Question

When is it appropriate to use a root cause analysis

Answered: 1 week ago