Thursday, 16th October at noon
For this project you will implement two classes, a Book class and a Student class. Your Book class will have the following fields (or member variables):
Book.h
that defines the Book class. It needs the following functions:
Book(int num, char* bkName, char* authName)
~Book()
int getBookNumber() const, char* getBookName() const, char* getBookAuthor() const
bool isAvailable() const
void setBookNumber(int num)
void displayBook() const
bool checkOut()
bool checkIn()
bool equals(Book const & book) const
Book.cpp
that implements the above functionality. Student.h
that defines the Student class. It needs the following functions:
Student(int num, char* sName)
~Student()
int getStudentID() const, char* getName() const
bool hasABook() const
void setStudentID(int num)
void displayStudent() const
bool checkOutBook(Book* book)
bool checkInBook()
bool equals(Student const & stud) const
Student.cpp
that implements the above functionality. printLibrary
that can print your list
of books, and whether each is available or not (define the
parameters to this method that best fits your design). You will see the
line "Print library" in the input file that would then tell your
program to call this method. After each action taken by a
student, please print the details of that Student (call their
displayStudent method). In general, you can create other helper
methods inside testLibrary.cpp
if you want, and if it
makes your code easier to organize or more readable.Book.h
,
Book.cpp
, Student.h
, Student.cpp
, and
testLibrary.cpp
to the DropBox in Minerva. Make sure your name is on the top of
each file.
You can turn in your files as many times as you
want to Minerva; I will only take the last one submitted.Book.h
Book.cpp
Student.h
, Student.cpp
, testLibrary.cpp
Answer the following questions in written form in comments after your name at the top of testLibrary.cpp. For the implementation questions, implement them in the appropriate file.
changeBookNumber
inside
testLibrary.cpp
so the librarian can change a
book number if necessary. Have the function return true if the change
succeeded. You can decide on the parameter list for this function
(so you can find the right book, and then also pass the new number
for that book). printStudentsWithBooks
inside testLibrary.cpp
so the librarian can see a list of all students that currently
have a book checked out.