Question: from datetime import date class Appointment(object): def __init__(self,day,month,year,description): self.description=description self.date=date(year,month,day) def __unicode__(self): return self.description def occursOn(self,day,month,year): if self.date == date(year,month,day): return True else: return False

from datetime import date

class Appointment(object): def __init__(self,day,month,year,description): self.description=description self.date=date(year,month,day) def __unicode__(self): return self.description def occursOn(self,day,month,year): if self.date == date(year,month,day): return True else: return False class Onetime(Appointment): def __init__(self,day,month,year,description): super(Onetime,self).__init__(day,month,year,description) def __unicode__(self): return self.description class Daily(Appointment): def __init__(self,day,month,year,description): super(Daily,self).__init__(day,month,year,description) def __unicode__(self): return self.description #function over written def occursOn(self,day,month,year): return True # because daily appointment is true for all days class Monthly(Appointment): def __init__(self,day,month,year,description): super(Monthly,self).__init__(day,month,year,description) def __unicode__(self): return self.description #function over written def occursOn(self,day,month,year): if self.date.day == day: return True else: return False

appList = [] appList.append(Daily(1, 1, 2013, "Do pushups")) appList.append(Daily(15, 1, 2013, "Floss teeth")) appList.append(Monthly(15, 12, 2012, "Backup data")) appList.append(Onetime(21, 12, 2012, "Computer Science Final Exam")) appList.append(Monthly(4, 2, 2013, "Call grandma")) appList.append(Onetime(12, 4, 2013, "See dentist"))

day = int(input("Enter the day (0 to quit): ")) while day != 0 : month = int(input("Enter the month: ")) year = int(input("Enter the year: ")) for app in appList : if app.occursOn(day,month,year) : print(app.description) day = int(input("Enter the day (0 to quit): "))

In the above program, Improve the appointment book program of the previous exercise. Give the user the option to add new appointments. The user must specify the type of appointment, the description and date

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!