473,657 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Book Library system

20 New Member
Please can someone help in correcting the following attempt of the questions below. I have included my attempt at the problem
I have been asked to write class definations which does the following among other things in C++.
a) Library needs to able to get the following information about its customers: firstname, last name, address and telephone numbers.

b) the library needs to be able to add customers and books to its records.

Assume these records need not be modified or deleted in any way

Expand|Select|Wrap|Line Numbers
  1.     // This program get or request the customer to enter their details and or details of the book.
  2. # include <iostream.h>
  3. # include “Library.h”
  4. int Main ()
  5. {
  6. Void display Customer details (Char*Char[], String);
  7. Void display books details (Char*Char[], double);
  8. Void display books on loan (Char, date)
  9. Void display books due (Char, date);
  10.  
  11.  
  12.  
  13.  
  14. Void add customers, books (Char*Char[], double);
  15. Void print report details (Char, double, string);
  16. }
  17. Void Library: : display customers details ()
  18. {
  19. cout << “Enter First name” <<endl;
  20. cin >> First name;
  21. cout << “Enter Last Name” <<endl;
  22. cin >> Last name;
  23. cout << “Enter Address” <<endl;
  24. cin >> Address;
  25. cout << “Enter telephone number” <<endl;
  26. cin >> telephone number;
  27. }
  28. Void Library: : Display Book details ()
  29. {
  30. cout << “Enter Title” <<endl;
  31. cin >> Title;
  32. cout << “Enter Author” <<endl;
  33. cin >> Aithor;
  34. cout << “Enter ISDN Number” <<endl;
  35. cin >> ISDN Number;
  36. cout << “Enter Number of pages” <<endl;
  37. cin >> Number of pages;
  38. }
  39. Void Library: : Display book loans ()
  40. {
  41. int on loan date;
  42. int date due returned;
  43. cout << “enter on loan date” <<endl;
  44. cin >> on loan date;
  45. cout << “Enter date due returned” <<endl;
  46. cin >> Date due returned;
  47. }
  48.  
  49. Void Library: : Add Customer, Books ()
  50. {
  51. cout << “Add First name”<<First name<< “Last name” <<Last name<< “Address” <<Address<< “telephone number” <<telephone number<<endl;
  52. cin >>First name >>last name >>Address >>Telephone number;
  53. cout << “Add Title<< Title<< “Author”<< Author<< “ISDN Number”<< ISDN Number<< “number of pages”<< Number of pages <<endl;
  54. cin >> Title>> Author>> ISDN number>> Number of pages;
  55. }
  56. Void Library: : Display customer loans ()
  57. {
  58. int on loan date;
  59. int date due returned;
  60. cout << “enter on loan date” <<endl;
  61. cin >> on loan date;
  62. cout <<”Enter date due returned” <<endl;
  63. cin >> Date due returned;
  64. }
  65. Void Library: : Print detail report ()
  66. cout << “The details of each customer with loan books is”<<customer<<endl;
  67. cout<< “The detail of each book on loan is”<<book<<endl;
  68. cout << “The detail of loan is” <<loan<<endl;
  69.                 or
  70. }
  71. Void Library: : print detail report()
  72. cout << “customer”<< “book”<< “loan”<<endl;
  73. cin >> customer>>book>>loan>>endl;
  74. }
  75. Return 0;
  76.  
c) wrie the implementation of the customers class in C++

iii) Class Customer
Expand|Select|Wrap|Line Numbers
  1. {
  2. Public: :        // Modifiers
  3.     Customer (); // default constructor
  4. Void display customer details (Char*Char [], String);
  5. Private: :        // Queries
  6.     Char First name [20], Last name[25];
  7.     Char Address;
  8.     String Telephone number;
  9. };
  10.  
D) SUPPOSE THE CUSTOMER WANTS TO FIND A SPECIFIC book and knows the title of the book. Write a program that iterates through its records of books and return to a pointer to the matching book

iv) Class Library
Expand|Select|Wrap|Line Numbers
  1. {
  2. Public : 
  3.         Library ();
  4.         Void display total records of books (Char, double);
  5.  
  6. Private:
  7.         Char Title, Author;
  8.         Double ISDN number, Number of pages
  9.  
Feb 15 '07 #1
4 5607
Ganon11
3,652 Recognized Expert Specialist
OK, so what parts are you having trouble with?
Feb 15 '07 #2
enri
10 New Member
What I would do is create three classes: one class for the book object, one for the customer object, and one class for the library, that is a collection of both books and one of customers, implemented as lists.
Henceforth, my headers would look something like:

Expand|Select|Wrap|Line Numbers
  1. class Book{
  2.     private:
  3.         string Title;
  4.         string Author;
  5.         int ISSBN;
  6.     public:
  7.         Book *pnext;
  8.  
  9.         Book();
  10.         Book(string tit, string aut, string ed, int i);
  11.  
  12.         string getTitle();
  13.         string getAuthor();
  14.         int getIssbn();
  15. };
  16.  
  17. class Customer{
  18.     private:
  19.         string Name;
  20.         string Surname;
  21.         string Address;
  22.                         string Phone;
  23.     public:
  24.         Customer *pnext;
  25.  
  26.         Customer();
  27.         Customer(string name, string surname, string addres, string phone);
  28.  
  29.         string getName();
  30.         string getSurname();
  31.         string getAddress();
  32.                         string getPhone();
  33. };
  34.  
  35. class Library{
  36.     private:
  37.         Book *collection;
  38.                         Customer *contacts;
  39.  
  40.     public:
  41.         Library();
  42.         ~Library();
  43.  
  44.         Book* getFirst_book();
  45.         void Insert_book(Book *pl);
  46.         void Display_book(Book *pl);
  47.                         void Search_book(string title);
  48.                         Customer* On_loan(Book *pl) 
  49.  
  50.                         Customer* getFirst_customer();
  51.         void Insert_customer(Customer *pl);
  52.         void Display_customer(Customer *pl);
  53.  
  54. };
Feb 15 '07 #3
jchimanzi
20 New Member
OK, so what parts are you having trouble with?

Could you check the code for me especially the last part part D
Feb 15 '07 #4
AdrianH
1,251 Recognized Expert Top Contributor
What you have written is pseudo-code, yes? Because, just by looking at it, it is not even close to be compliable.

What problems are you having exactly?


Adrian
Feb 15 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1455
by: C++ Shark | last post by:
Hi!, sorry for this cross post, but i am not sure which group is most relevant to my question. I am looking for a good book on programming in C/C++ for the intel processors. If you know of any such material, please post a reply. thanks, Craig
5
1550
by: Kleidemos | last post by:
http://www.amazon.com/exec/obidos/tg/detail/-/1584502274/002-5832236-8289662?v=glance I bougth, in my holliday in London, this book. It is a good book? With this book.......can i know more C++ tecnics and cognitions??? -- Tnk Luca "Kleidemos" Francesca Un computer a un altro quando si incontrano:
14
1686
by: Materialised | last post by:
Hi All, I'm just looking for some suggestions on a good book that will cover the C++ standard well. I Know C (quite) well, and learnt this language by reading as much source code as possible and using Herbert Schildt's C The Complete Reference (4th Edition) as a reference where needed. I was thinking about purchasing C++: The Complete Reference (4th Edition) and attempting to learn C++ in a similar way.
12
1876
by: Computer Whizz | last post by:
Hiya guys, I saw this (C++ Programmer's Reference by Herbert Schildt) book in the library today, and wondered what the experienced programmer thought about it before I decided to dive in and get it. Most of the posts I've read seem to have an opinion of a wide variety of books, yet I did a google search of this group and didn't find much - maybe the odd mention of the author.
2
1314
by: OHM | last post by:
Windows Forms Controls. Has anyone personally read and recommends a good book which includes good coverage on DataGrids as this seems to be one of the most common problem areas. Regards - OHM
1
7147
by: jchimanzi | last post by:
Can someone check this program for me to see if its correct. I need to have a program which is able to add books,add customers, allow customer x to take out book y, and print out report v) Void Library: : Add Customer, Books () { cout << “Add Title<< UML Distilled<< “Author”<< Martin Fowler<< “ISDN Number”<< ISDN << “number of pages”<< 170 pages <<endl; cin >> UML Distilled >> Martin Fowler >> ISDN >> 170 pages; }; cout << “Add Title<<...
35
5822
by: pandit | last post by:
is this book good for learning C ? i am a beginning programmer, Kernighan and Ritchie 2e is quite hard on me.
263
9225
by: Malcolm McLean | last post by:
The webpages for my new book are now up and running. The book, Basic Algorithms, describes many of the fundamental algorithms used in practical programming, with a bias towards graphics. It includes mathematical routines from the basics up, including floating point arithmetic, compression techniques, including the GIF and JPEG file formats, hashing, red black trees, 3D and 3D graphics, colour spaces, machine learning with neural...
126
4348
by: jacob navia | last post by:
Buffer overflows are a fact of life, and, more specifically, a fact of C. All is not lost however. In the book "Value Range Analysis of C programs" Axel Simon tries to establish a theoretical framework for analyzing C programs. In contrast to other books where the actual technical difficulties are "abstracted away", this books tries to analyze real C programs taking into account pointers, stack frames, etc.
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.