Question: Write a Python program, in a file dates.py , that maintains a collection of Date objects, each of which has associated with a set of
Write a Python program, in a file dates.py, that maintains a collection of Date objects, each of which has associated with a set of strings that refer to events for that date, processing these objects in accordance with operations read from an input file.
Basicly it's storing dates and events in objects and and displaying them based on inputs from a file.


Example test file:
I 1960-02-27 : U.S. Olympic hockey team beats Soviet Union I 1897-2-27 : Britain recognizes U.S. authority over Western Hemisphere I Apr 5 1974 : World Trade Center, then the world's tallest building, opens in New York I 1946-1-10: UN General Assembly meets for 1st time (London) R Feb 27 1960 I 3/4/1861 : Abraham Lincoln is inaugurated as 16th US President I 4/5/1242: Alexander Nevsky of Novgorod defeats Teutonic Knights in the Battle of the Ice I Apr 5 1879 : Chile declares war on Bolivia and Peru, starting the War of the Pacific R 1879-04-05 I 6/25/1667 : First blood transfusion performed by French Doctor Jean-Baptiste Denys I 1876-06-25 : Battle of the Little Bighorn R 6/25/1876 I Jul 20 1881 : Sioux Indian Chief Sitting Bull, surrenders to US federal troops I Jul 20 1921: Congresswoman Alice Mary Robertson becomes the first woman to preside over the US House of Representatives I 1954-07-20: Armistice for Indo-China signed, Vietnam separates into North & South I 1969-7-20: 1st Moon Landing: Neil Armstrong and Buzz Aldrin from Apollo 11 R 7/20/1921 R 07/20/1969 R Jul 20 1954
Example output for file:
1960-2-27: U.S. Olympic hockey team beats Soviet Union 1879-4-5: Chile declares war on Bolivia and Peru, starting the War of the Pacific 1876-6-25: Battle of the Little Bighorn 1921-7-20: Congresswoman Alice Mary Robertson becomes the first woman to preside over the US House of Representatives 1969-7-20: 1st Moon Landing: Neil Armstrong and Buzz Aldrin from Apollo 11 1954-7-20: Armistice for Indo-China signed, Vietnam separates into North & South
CSc 120: Dates Background This problem involves managing a database of dates and events, for example, for a calendar app or history website. The purpose of this assignment is to use classes objects, and asserts. Problem Description Suppose you wanted to offer a website or app to manage a database of dates and events. Such a database might be used to look up dates in the past (on this date in history...", as in the sites mentioned above); or they might be used as a calendar service to provide reminders for future events. In either case, you need a program that can record and look up strings (i.e., events) associated with dates One catch here is reasoning about dates. People use many different formats to write dates, e.g., "December 25, 2016", "2016-12-25", and "12/25/2016", all of which represent the same date. The format that was used to insert an event into the database may or may not be the same as the format used to look up up that date. Your program therefore needs a way to reason about dates in different formats. This problem involves writing a class to maintain information about dates and events and reason about dates in different formats. The idea is to read a file containing a series of operations, where each operation refers to a database of dates and events, and process each operation in turn nput Formats The input to the program is read from a file (see Expected Behavior below). Each line of the file is an operation, and is in one of the following two formats I Date: Event R Date The fields in an operation are as follow:s Date This specifies a date. It can be in any of the following three formats WW-mm-dd, where yyy is a 4-digit sequence giving the year, mm is a 1-or 2-digit sequence giving the month; and dd is a 1-or 2-digit sequence giving the date Example: 2017-02-31 . mm/dd/yyyy, where yyyy is a 4-digit sequence giving the year, mm is a 1- or 2-digit sequence giving the month, and dd is a 1- or 2-digit sequence giving the date Example: 02/31/2017 MonthName dd yyy, where MonthName is a three-letter sequence giving the name of a month (one of. Jan, Feb, Mar, Apr, May, Jun Jul, Aug, Sep. Oct, Nov, Dec); dd is a 1- or 2-digit sequence giving the date; and yyyy is a 4-digit sequence giving the year. Example: Feb 31 2017 NOTE: To simplify programming, we will assume that all months have 31 days Event This is a string starting at the first non-whitespace character after the colon":" following the date and going as far as the end of the line. Examples of operations are I 2017-01-16: Martin Luther King Day I Mar 31 1997 Arizona Wildcats win National Basketball Title R 03/31/1997 The first of these inserts the event "Martin Luther King Day" for the date Jan 16, 2017 into the calendar. The second adds the event "Arizona Wildcats win National Basketball Title" for the date March 31,_1992. The third item retrieves and prints out all events for the date March 31,_1997
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
