Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Your task for this assignment is to write a program that reads in a date and calculates the number of days until the 4th

Python

Your task for this assignment is to write a program that reads in a date and calculates the number of days until the 4th of July for the year given in the date.

Details:

? The user will enter a date as an 8-digit number representing: MMDDYYYY

? The program must validate the month and day. For example, if the user enters 04312018, your program should tell the user that there is an error in the input, since April only has 30 days. Likewise, if the user enters 13102017 your program should tell the user that there is an error in the input, since there are only 12 months in a year.

? Leap years: To get an accurate count of how many days until July 4, you will need to check if the year entered is a leap year or not. On leap years, the month of February has 29 days. On regular years, February has 28 days. Leap years happen once every 4 years when the year is divisible by 4. For example, 2016 is a leap year; and so is 2000. However 1800 is not a leap year, neither is 1900. A more detailed description of a leap year is: the year is divisible by 4 but not by 100; if a year happens to be divisible by 4 and 100, it is a leap year only it is divisible by 400 as well.

? The program should display the number of days until July 4. If the user enters July 4 as the input date, indicate that its July 4th. If the user enters a date after July 4, display a message stating that July 4 has already past.

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

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

Compare the current team to the ideal team.

Answered: 1 week ago

Question

Are the rules readily available?

Answered: 1 week ago

Question

Have ground rules been established for the team?

Answered: 1 week ago