The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Write a Python program "daysInMonthXXXXX.py" where XXXXX should be replaced by your ID. The program ask user to enter a accepts 2 inputs: a month and year. The program then calculates the number of days in this month of this year. The algorithm to determine if a year is a leap year or not can be found here: http://www.timeanddate.com/date/leapyear.html A year is leap if it is divisible by 400 (example 1600). A year is leap if it is divisible by 4 but not divisible by 100 (example 2012). A year is Not leap if it is divisible 4 and by 100 (example 1700). A year is Not leap if it is not divisible by 4(example 2013). Your program should display an error message when user enters a 0 or negative number for a year. A month also has to be from 1 through 12. Create a function isLearYear(year) and put code for leap year determination in this function. This function should return either true or false. Create a function daysInMonthYear(month, year) to do the calculation of days in month. This function returns the number of days. Main function should read the input, check the input values, print error message if inputs are not valid. If both inputs are good, then main will call the function daysInMonthYear(month, year). Examples of program run: This program was written by <your name> Please Enter a year: 2001 Please Enter a month: 2 There are 28 days in the month 2 of year 2001 ------------------------------------------- This program was written by <your name> Please Enter a year: 2000 Please Enter a month: 2 There are 29 days in the month 2 of year 2000 ------------------------------------------- This program was written by <your name> Please Enter a year: 1600 Please Enter a month: 2 There are 29 days in the month 2 of year 1600 ------------------------------------------- This program was written by <your name> Please Enter a year: 1700 Please Enter a month: 2 There are 28 days in the month 2 of year 1700 ------------------------------------------- This program was written by <your name> Please Enter a year: 2000 Please Enter a month: 1 There are 31 days in the month 1 of year 2000 ------------------------------------------- This program was written by <your name> Please Enter a year: 2000 Please Enter a month: 3 There are 31 days in the month 3 of year 2000 ------------------------------------------- This program was written by <your name> Please Enter a year: -2 Invalid year -2 ------------------------------------------- This program was written by <your name> Please Enter a year: 2000 Please Enter a month: 13 Invalid month 13