Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- listAppointments=[]
- class Appointment():
- def __init__(self):
- self._description=""
- self._listAppointments=[]
- def setDescription(self,x):
- self._description=x
- def occursOn(self,year,month,day):
- oa=1
- class Onetime(Appointment):
- def __init__(self,year,month,day,reason):
- super().__init__()
- self._year=year
- self._month=month
- self._day=day
- self._reason=reason
- def setDate(self):
- year=str(self._year)
- month=str(self._month)
- day=str(self._day)
- reason=str(self._reason)
- stringDate=str(month)+str(day)+str(year)
- if len(listAppointments)==0:
- listAppointments.append(stringDate+reason)
- else:
- found = False
- counter = 0
- while found==False and counter<len(listAppointments):
- if listAppointments[counter][:6]==stringDate:
- found=True
- if len(stringDate)==6:
- b=listAppointments[counter]
- b=b+reason
- listAppointments[counter]=b
- else:
- listAppointments.append(stringDate+reason)
- found=True
- counter+=1
- class Daily():
- def __init__(self,year,month,day,reason):
- super().__init__()
- self._year=year
- self._month=month
- self._day=day
- self._reason=reason
- def setDate(self):
- year=str(self._year)
- month=str(self._month)
- day=str(self._day)
- reason=str(self._reason)
- for i in range (0,1000):
- dayInt=int(day)
- dayInt=dayInt+1
- day=str(dayInt)
- if dayInt>30:
- day=0
- month+=1
- if month>12:
- year+=1
- stringDay=str(month)+str(day)+str(year)
- if len(listAppointments) == 0:
- listAppointments.append(stringDate + reason)
- else:
- found = False
- counter = 0
- while found == False and counter < len(listAppointments):
- if listAppointments[counter][:6] == stringDate:
- found = True
- if len(stringDate) == 6:
- b = listAppointments[counter]
- b = b + reason
- listAppointments[counter] = b
- else:
- listAppointments.append(stringDate + reason)
- found = True
- counter += 1
- stringDate=1
- dentist=Onetime("19","03","19","BOBS BURGERS")
- dentistry=Onetime("19","03","19","DENTIST")
- school=Onetime("20","11","20","SCHOOL DAY")
- dentist.setDate()
- dentistry.setDate()
- school.setDate()
- school2=Daily("07","23","19","SCHHOOOOL")
- school2.setDate()
- print(listAppointments)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement