Comp 115 Programming Assignment 02: Date Formatting

Due 11:59pm Tuesday, February 25 2020

You are required to work on this lab in teams of two. You must complete this lab with your teammate only, although you may discuss lab concepts with other students. Please keep the Academic Integrity Policy in mind---do not show your code to anyone outside of the professors and tutors, and do not look at anyone else's code for this lab. If you need help, please post a question on Piazza, or contact the professor.

In this project, you will practice computing with strings and using functions. I kept it relatively short, so you will have enough time to complete it before the exam and get some practice. Save your code in a file whose name consists of the first letter of your first name followed by your last name and Prg2. For example, if I submitted an assignment, I would name the file mgagnePrg2.py.

The Problem

In the U.S., dates are typically written in the format MM-DD-YYYY, but that format is not used in much of the rest of the world. In this assignment, you will write a program that takes a date in this format and transform it into others.

Input

Your program should ask the user to enter a date in the format MM-DD-YYYY (e.g. 02-18-2020). Your program does not need to check that a date with the proper format was entered, you can assume that the user entered the date properly.

Output

The program should print three things:

Specifics

Your program is required to contain the following functions:

Your program should also contain a function main that acts as the user interface, asks the user to enter a date in the format MM-DD-YYYY, transforms it into the various other formats and displays the result on screen.

To complete all the functions except for format3, you should only need slices and operators on strings. To complete format3, you should not use any conditional statements, you should only use slices, operators and the string method replace. Doing this will require a little bit of unconventional thinking, feel free to come to me or the tutors for help if you are having trouble with this.

Notes

Like the previous assignment, your submitted assignment should start with a header containing the name of the author(s), filename, description of the program, input and output.

Make sure you test your program with a variety of possibilities for date, but you only need to test it on valid inputs, your program is allowed to behave arbitrarily on invalid dates.