// library.h // ---------------------------------------------------------------------- // Do not modify this file. // misc. library-related functions for use in main.cpp // // CSE 143 // Homework 3 // http://www.cs.washington.edu/education/courses/143/00su/homework/ // 03 Jul 2000 #ifndef _LIBRARY_H_ #define _LIBRARY_H_ #include "lbooklst.h" #include "lpatrlst.h" //#include "lbook.h" ////////////////////////////////////////////////////////////////////// // constants // in days const int LOAN_DURATION = 21; // overdue fines, in cents; used in computeFine const int FIXED_FINE = 75; const int PER_DAY_FINE = 15; ////////////////////////////////////////////////////////////////////// // prototypes // pauses until user types a non-whitespace character and Return void waitForChar(void); // computes fine in cents for a book overdue by given number of days; // see constants above int computeFine(int daysOverdue); // reads given transaction log file and processes each transaction, // printing per-transaction data and overdue fine information, if // applicable; calls processTransaction once for each transaction void processTransactionsFile(char fileName[], LibraryBookList &bookList, LibraryPatronList &patronList); // returns true if given date, user ID, and transaction code are all // valid; i.e. date valid, user ID > 0, code == 'o' or 'i' bool transactionIsValid(Date transactionDate, int userID, char transactionCode); // using given book and patron lists, attempts to update the // appropriate element from each list according to the given // transaction (check-in or -out) void processTransaction(LibraryBookList &bookList, LibraryPatronList &patronList, Date transactionDate, int userID, char transactionCode, int bookID); // called from processTransaction to verify that check-in or -out of // the given book by the given patron is allowed, and to update the // book and patron objects void processCheckOut(LibraryBook &book, LibraryPatron &patron, Date date); void processCheckIn(LibraryBook &book, LibraryPatron &patron, Date date); #endif // _LIBRARY_H_