CS303e Assignment 5

Due: Thursday, 6/27

File Name: later_date.py (Program name must match this exactly, including case of letters.)

Submit to Assignment 5 on Gradescope via Canvas

Purpose: To practice using variables, creating expressions, and using conditional logic. No loops on this assignment.

Limitations: You may only use the Python syntax and language features covered in the book chapters 1 - 3. Specifically you may not use lists, sets, dictionaries or any other data structures. You may not use the Python time, datetime, or calendar modules or any other module for working with dates and / or times. In other words, you must do all the calculations on what the later day, month, and possibly year will be, yourself.

Review the assignment guidelines.

Write a program that prompts the user to enter a year, month, day, and the number of days to skip. The program then determines the date after the number of days to skip.

  For example:

Input:

Your program shall ask the user for the month (a string), the day (an integer), the year (an integer), and the number of days to skip (an integer) in that order.

Your program does not need to validate the input; that is you may assume the user enters valid days for given months, valid month names, a valid year (>=1), and that the days to skip shall be between 1 and 20 inclusive.

Your program DOES need to check for leap years! If the user enters a date of February 28 and the year is a leap year, the next day should be February 29. If the year is not a leap year, the next day is March 1. We discussed determining  if a year was leap year in the slides and videos on conditionals. You may use that code as is in your program.

Expected output:

Format your output so that, if the user were to enter September 19, 2018, and 1 day, your output shall look exactly like the following. There is a blank line following the last line of visible output. (Example 1):

This program asks for a date and days to skip.
It then displays the date that many days after the given date.

Enter the month: September
Enter the day of the month: 19
Enter the year: 2018

Enter the number of days to skip: 1

1 day after September 19, 2018 is September 20, 2018.

Here are two more examples.
Example 2:

This program asks for a date and days to skip.
It then displays the date that many days after the given date.

Enter the month: February
Enter the day of the month: 20
Enter the year: 2020

Enter the number of days to skip: 20

20 days after February 20, 2020 is March 11, 2020.

Example 3:

This program asks for a date and days to skip.
It then displays the date that many days after the given date.

Enter the month: December
Enter the day of the month: 15
Enter the year: 1975

Enter the number of days to skip: 18

18 days after December 15, 1975 is January 2, 1976.

** More sample input and output in this file. If you think your have the output correct, but are failing tests on GradeScope it may be useful to compare the results in the file to your output using a diff (short for difference) checker. You may have an app that does this on your computer or you can use a website such as https://www.diffchecker.com/

Recall, you must include and fill out the header for the assignment and place it at the top of the program. Replace any items in <> with the proper information and  delete the <>.

# File: later_date.py
# Description: <A DESCRIPTION OF YOUR PROGRAM>
# Assignment Number: 5
#
# Name: <YOUR NAME>
# EID:  <YOUR EID>
# Email: <YOUR EMAIL>
# Grader: <YOUR GRADER'S NAME Mayra or Risha>
#
# On my honor, <YOUR NAME>, this programming assignment is my own work
# and I have not provided this code to any other student.