Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Tale USE JAVA PLEASE For this program, you will input three pleces of a date as int data: a month, a day, and a year

image text in transcribed
Tale USE JAVA PLEASE For this program, you will input three pleces of a date as int data: a month, a day, and a year Remaining days: 329 SAMPLE RUN (user input is underlined) Enter month: Enter day: 39 Enter year: 2018 if the date is valid, caloulate and output the day of the year The calculation will need to take into account leap years, meaning that 12/31/2018 would be day of year 365 whereas 12/31/2020 would be day of the year 366 because of the extra day for February 29th, 2020. A valid date needs to satisfy the following requirements: The month needs to be between 1 and 12, inclusive. The day needs to be appropriate for the month. For example, the day should be between 1 and 31 for March or between 1 and 30 for September. The day should be between 1 and either 28 or 29 depending on if the year is a leap year. The year needs to be between 1800 and 3000, inclusive. INVALUD DATE: 05/39/2018 SAMPLE RUN (USER INPUT IS UNDERLINE Enter month: 2 Enter day: 29 Enter year: 2018 After the date information has been read from the user, print a single blank line and then one of the following two results. If the date is valid, process and calculate the day of the year and output the results in the following format: Day of the year: 36 Remaining days: 329 INVALID DATE: 02/29/2018 If the date is invalid for any reason, output an error message in the following format, with month and day padded with 0 s to be at least two digits and year padded with Os for four digits SAMPLE RUN (USER INPUT IS UNDERLINE Enter monch:2 Enter day 29 Enter year: INVALID DATE:-2/01/2000 INVAUD DATE: 04/01/0010 SAMPLE RUN (user input is underlined Enter month: 2 Day of the year 60 Remaining days 306 Erter day. Enter year 2018 Day of the year: 36 PLEASE ONLY USE SWITCH AND SIMPLE BOOLEAN CONDITONS

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_2

Step: 3

blur-text-image_3

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

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions