diff --git a/Books.cpp b/Books.cpp new file mode 100644 index 0000000..da456ba --- /dev/null +++ b/Books.cpp @@ -0,0 +1,41 @@ +#include "Books.h" +#include +#include +using namespace std; + +Books::Books() +{ + fee=0; +} + +Books::Books(string member, int numDays) +{ + name=member; + + fee=numDays * 0.50; +} + +void Books::setName(string member) +{ + name=member; +} + +string Books::getName() const +{ + return name; +} + + +void Books::setFee(int numDays) +{ + + fee=numDays * 0.50; + +} + +double Books::getFee() const +{ + return fee; +} + + diff --git a/Books.h b/Books.h new file mode 100644 index 0000000..92cb46e --- /dev/null +++ b/Books.h @@ -0,0 +1,37 @@ + +#ifndef BOOKS_H +#define BOOKS_H + +#include +#include + +using namespace std; + +class Books +{ + + public: + Books(); + + Books(string, int); + + void setName(string); + + string getName() const; + + void setFee(int); + + double getFee() const; + + + + + + private: + string name; + double fee; + + +}; + +#endif diff --git a/Library.cpp b/Library.cpp new file mode 100644 index 0000000..310c271 --- /dev/null +++ b/Library.cpp @@ -0,0 +1,86 @@ +#include +#include +#include +#include + +#include "Books.h" + +using namespace std; + +int linearSearch(vector&, string); + +int main() +{ + + vectorObooks; //vector of object overdue books + + string member; + int days,amt,num; + + cout<<"\nPlease enter the following information for overdue books"; + cout<<"\n How many late members are there? "; + cin>>amt; + + for (int x=0; x>member; + + cout<<"Please enter the number of days late: "; + cin>>days; + + Books lateMembers(member,days); + + Obooks.push_back(lateMembers); + + cout<>value; + + while(value != "!") + { + num= linearSearch(Obooks,value); + + if (num==-1) + { + cout<<"Name was not found"<>value; + + } + + + return 0; +} + + +int linearSearch (vector& Data, string key) +{ + for(unsigned int i=0; i