sir,
i have been set an assignment by my university....we are so badly taught that i have absolutley no idea how to do it! I would be more than happy to post payment for however much you feel your time is worth...
 
Please,please help:
 
ex.1)    Extend to the library database to include category of loan for overnight + 4 week loans-you should use the following data types.The TIME and DATE are the due time and date for books.You should provide enough data to reasonably test your code.
 
data LoanType   = Overnight Date Time | FourWeek Date
                            deriving (Show,Read)
data Time         =Time (Hours,Minutes)
                               deriving (show,Read)
data Date           =Date (Year,Month,DayNum)
                                deriving (Show,Read)
type Hours        = Integer
type Minutes     =Integer
type Year       =   Integer
type DayNum    =Integer
data Month    = January|Februrary|March|April|May|June|July|August|September|October|November|December
           deriving (Eq,Ord,Enum,Show,Read)
 
overdue books are fined at the following rates:
 
OVERNIGHT the due time is 24 hours from the time borrowed to the nearest hour above (for example,a book borrowed at 12.35 would be due back at 13.00 the next day).Overdue books are fined at 0.1p per minute rounded to the nearest penny.
 
FOURWEEK the due date is four weeks from the borrowing date.Overdue books are fined at 10p per day
 
 
 
ex.2)   To calculate fines you will need to impliment functions over DATE and TIME.You will also need a data type to represent time periods:
 
      data TimePeriod  = TimePeriod (Days,Hours,Minutes)
                                   deriving (Eq,Ord,Show,Read)
      type Days            = Integer
 
*afterTime      which takes two times and returns True if the first is after the second.
*beforeTime      which takes two times and returns True if the first is before the 2nd                                                                                
*timeBetween      which takes two times and returns the time between the first and the 2nd
*timeIncr    which takes a time and a time period and returns a new time (time should be represented as a 24 hour clock
*timeTo24String       which takes a tim eand displays it as a string in 24hr format
*timeTo12String         which takes a time and displays it as a string in 12 hour format
 
 
ex.3)    Make DATE and TIME instances of the type classes Eq and Ord
 
ex.4)    For overnight books most fines are on the same day-write a function that takes a book and a time and calculates the fine on the book (assuming it is returned on the due date but after the due time).
 
 
If you could help i will be extreamly gratefull!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[EMAIL PROTECTED]                                      

Reply via email to