Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

By using PYTHON : The attached main program is just a very rough cut to give you

ID: 3691190 • Letter: B

Question

By using PYTHON :

The attached main program is just a very rough cut to give you a bit of an idea of how the program is to work.

You will want to add a good user interface that would allow the user to get the appointments for, say, a specific

date.

It should also allow this for, perhaps, today,tomorrow , or the next 7 days.

It might look something like this:

Get appointments for:

1. Today

2. Tomorrow

3. Seven days (including today)

4. A specific date

If a 1, 2 or 3 is entered, the appointments are listed.(It does not ask for today’s date ...)

If a 4 is entered, then the user is prompted for the desired date, and the appointments

are then listed.

It would be good if your program included a check for valid dates. In other words, the

user could not enter 2/29/2017, since February does not have 29 days next year.

Use this program to show off everything that you can do with Python!

Also note that you should have a superclass for Appointment, and then subclasses for

the variations (e.g. Daily, OneTime, Monthly).

Again you will have a file with the main function, one [or more] with the classes and

one for getData.

The given text file is "dates.txt" :

Monthly,4,11,2016,11:30 AM,Book order
OneTime,5,1,2016,12:00 AM,Buy Furnace Filters next Monday
OneTime,4,10,2016,12:00 AM,Leash's Birthday
OneTime,4,26,2016,10:00 AM,Maverick Tour
Daily,4,1,2016,7:00 AM,Check sump pump
OneTime,3,22,2016,8:00 AM,Board meeting
OneTime,4,22,2016,12:00 AM,Boat Policy payment today
OneTime,2,23,2016,1:45 PM,Blood Donation (redcrossblood.org)
OneTime,1,22,2015,9:15 AM,Perio Appointment
OneTime,5,6,2016,12:00 AM,Mandy's Birthday
OneTime,4,30,2016,1:00 PM,Dental Appointment
Monthly,4,1,2016,12:00 AM,Archive Email
OneTime,4,22,2016,7:00 PM,*** SPRING FLING ***
OneTime,4,6,2016,9:00 AM,*** CALL DFAS ***
OneTime,5,7,2016,12:00 AM,Brooke's birthday
OneTime,2,24,2016,2:45 PM,Annual Physical
OneTime,6,28,2016,12:00 AM,Brett & Amanda's Wedding
OneTime,4,9,2016,12:00 AM,Bob and Sally's Wedding
OneTime,4,7,2016,12:00 AM,Amazon delivery of dog shampoos
OneTime,4,1,2016,4:00 PM,Advising Session
OneTime,6,10,2016,7:00 PM,Boy Scout phone call
Daily,1,1,2015,8:00 PM,*** FLOSS ***
Daily,1,20,2016,9:00 AM,Office Hours
Daily,4,1,2016,7:00 PM,Coffee at 'Bou
Monthly,1,1,2015,12:00 AM,Douglas' heartworm pill
OneTime,4,28,2016,12:00 AM,Sarah and Ann's Wedding
OneTime,4,1,2016,12:00 AM,Batteries in cabin security panel
OneTime,1,11,2015,12:00 AM,AlumaCraft renewal on 29-DEC
OneTime,4,5,2016,1:15 PM,Annual vision exam
OneTime,2,17,2015,9:00 AM,Student Meeting
Monthly,5,12,2016,12:00 AM,Expense Report
OneTime,2,16,2015,12:00 PM,Student Meeting
OneTime,4,15,2016,9:00 AM,Beagle & Wolf Book Club
OneTime,4,25,2016,8:00 AM,Dental appointment

Explanation / Answer

Answer:

import datetime

txt=open(dates.txt)

print txt.read()

time1=1;

Ans1=True

while Ans1:

     print(""

     1.Today

     2.Tomorrow

     3.SevenDays(including today)

     4.A specific date

     "")

     Ans1=input("Enter a number for appoinment?")

                    if Ans1=="1":

          scheduleV(doctor1,patient1,time1)

     elif Ans1=="2"

          scheduleV(doctor1,patient1,time1)

     elif Ans1=="3"

          scheduleV(doctor1,patient1,time1)

     elif Ans!=="4"

     validDate(time1)

class PatientClass(object, Person1):

def __init__(self, f_name1, l_name1, ssn1):

    super(PatientClass, self).__init(f_name1, l_name1)

    self.ssn1 = ssn1

class DoctorClass(object, Person1):

def __init__(self, f_name1, l_name1, speciality1):

    super(DoctorClass, self).__init(self, f_name1, l_name1)

    self.speciality1 = speciality1

def scheduleV(self,doctor1,patient1,time1):

    self.time1 = time1

    self.doctor1 = doctor1

    self.patient1 = patient1

    if self.doctor1.is_available(time1) and self.patient1.is_available(time1):

        self.patient1.update_calendar(patient1,time1)

        self.doctor1.update_calendar(doctor1,time1)

        print "something"

        return True

def validDate(date_text1):

    try:

        datetime.datetime.strptime(date_text, '%Y-%m-%d')

    except ValueError:

        raise ValueError("Incorrect data format, should be YYYY-MM-DD")