You are here:

C++/how to make a project of library

Advertisement


Question
sir i want to make a program of library where i want following points to be included:
1.store the name of books available.
2.store the name of students and have a library card number
3.when a student comes and ask for a book we will search in library books and give him if available
4.date of issue should be stored and there should be a date of reissue .
5.if a student do not returns or reissue it within a given time he/she should be imposed fine.

Answer
implement the classes:
date - keep a calendar date eg. 12 june 2009
title - the book title eg. Ruminations on C++
copy - a copy of a particular title (one title can have many copies)
student - a library member.

class date
{
 // ...
};

class title
{
 public :
   // public functions
 private :
   std::string book_name ;
   std::string author ;
   std::string isbn ;
   std::vector<book*> copies;
   // other members
};

class copy
{
 public :
   // public functions
 private :
   int book_number ;
   title* the_title ;
   student* issued_to ;
   date issue_date ;
   date due_date ;
   // other members
};

class student
{
 public :
   // public functions
 private :
   std::string name ;
   int card_number ;
   std::vector<book*> borrowed_books ;
   // other members
};

have two lookup tables one mapping isbn number to the title object,
the other mapping library card number to student object.
 
std::map< std::string, title* > isbn_title_map ;

std::map< int, student* > card_student_map ;

now, put it all together in a program, with functions to
issue books, return books, calculate fine etc.

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


vijayan

Expertise

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.

Experience

about 15 years or so

Education/Credentials
post graduate engineer

©2016 About.com. All rights reserved.