CSE 1310 -004 Fall 2011 Tiernan Sample questions for Final Exam prep class method define function with parameters and return values 1) Write an algorithm to calculate the length in between two given dates. The length should be calculated as years, months, and days. Write the algorithm in words. Ex. What is the length of time between July 4, 1962 and May 19, 1969? 2) Write a function to take in two dates as six input values and return the length of time between them as three output values. The date values should be day, month, and year and the length of time should be years, months, and days. Tell the user what is happening in the function. def lengthoftime(d1,m1,y1,d2,m2,y2): # d1, m1 are variables holding date info 3) Given the class below, for date write a method that uses two dates and returns the length of time between those dates. class date: pass def lengthoftime(self,date2): # self.day, self.month are the variables holding date info date1 = date() date1.day = 19 date1.month = 5 date1.year = 1969 date2 = date() #assume values are given for date2 date3 = date1.lengthoftime(date2) Fraction class - do subtraction and determine if proper or improper