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 -
// This program get or request the customer to enter their details and or details of the book.
-
# include <iostream.h>
-
# include “Library.h”
-
int Main ()
-
{
-
Void display Customer details (Char*Char[], String);
-
Void display books details (Char*Char[], double);
-
Void display books on loan (Char, date)
-
Void display books due (Char, date);
-
-
-
-
-
Void add customers, books (Char*Char[], double);
-
Void print report details (Char, double, string);
-
}
-
Void Library: : display customers details ()
-
{
-
cout << “Enter First name” <<endl;
-
cin >> First name;
-
cout << “Enter Last Name” <<endl;
-
cin >> Last name;
-
cout << “Enter Address” <<endl;
-
cin >> Address;
-
cout << “Enter telephone number” <<endl;
-
cin >> telephone number;
-
}
-
Void Library: : Display Book details ()
-
{
-
cout << “Enter Title” <<endl;
-
cin >> Title;
-
cout << “Enter Author” <<endl;
-
cin >> Aithor;
-
cout << “Enter ISDN Number” <<endl;
-
cin >> ISDN Number;
-
cout << “Enter Number of pages” <<endl;
-
cin >> Number of pages;
-
}
-
Void Library: : Display book loans ()
-
{
-
int on loan date;
-
int date due returned;
-
cout << “enter on loan date” <<endl;
-
cin >> on loan date;
-
cout << “Enter date due returned” <<endl;
-
cin >> Date due returned;
-
}
-
-
Void Library: : Add Customer, Books ()
-
{
-
cout << “Add First name”<<First name<< “Last name” <<Last name<< “Address” <<Address<< “telephone number” <<telephone number<<endl;
-
cin >>First name >>last name >>Address >>Telephone number;
-
cout << “Add Title<< Title<< “Author”<< Author<< “ISDN Number”<< ISDN Number<< “number of pages”<< Number of pages <<endl;
-
cin >> Title>> Author>> ISDN number>> Number of pages;
-
}
-
Void Library: : Display customer loans ()
-
{
-
int on loan date;
-
int date due returned;
-
cout << “enter on loan date” <<endl;
-
cin >> on loan date;
-
cout <<”Enter date due returned” <<endl;
-
cin >> Date due returned;
-
}
-
Void Library: : Print detail report ()
-
cout << “The details of each customer with loan books is”<<customer<<endl;
-
cout<< “The detail of each book on loan is”<<book<<endl;
-
cout << “The detail of loan is” <<loan<<endl;
-
or
-
}
-
Void Library: : print detail report()
-
cout << “customer”<< “book”<< “loan”<<endl;
-
cin >> customer>>book>>loan>>endl;
-
}
-
Return 0;
-
c) wrie the implementation of the customers class in C++
iii) Class Customer -
{
-
Public: : // Modifiers
-
Customer (); // default constructor
-
Void display customer details (Char*Char [], String);
-
Private: : // Queries
-
Char First name [20], Last name[25];
-
Char Address;
-
String Telephone number;
-
};
-
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 -
{
-
Public :
-
Library ();
-
Void display total records of books (Char, double);
-
-
Private:
-
Char Title, Author;
-
Double ISDN number, Number of pages
-
4 5607 Ganon11 3,652
Recognized Expert Specialist
OK, so what parts are you having trouble with?
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: - class Book{
-
private:
-
string Title;
-
string Author;
-
int ISSBN;
-
public:
-
Book *pnext;
-
-
Book();
-
Book(string tit, string aut, string ed, int i);
-
-
string getTitle();
-
string getAuthor();
-
int getIssbn();
-
};
-
-
class Customer{
-
private:
-
string Name;
-
string Surname;
-
string Address;
-
string Phone;
-
public:
-
Customer *pnext;
-
-
Customer();
-
Customer(string name, string surname, string addres, string phone);
-
-
string getName();
-
string getSurname();
-
string getAddress();
-
string getPhone();
-
};
-
-
class Library{
-
private:
-
Book *collection;
-
Customer *contacts;
-
-
public:
-
Library();
-
~Library();
-
-
Book* getFirst_book();
-
void Insert_book(Book *pl);
-
void Display_book(Book *pl);
-
void Search_book(string title);
-
Customer* On_loan(Book *pl)
-
-
Customer* getFirst_customer();
-
void Insert_customer(Customer *pl);
-
void Display_customer(Customer *pl);
-
-
};
OK, so what parts are you having trouble with?
Could you check the code for me especially the last part part D
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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:
|
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.
|
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.
|
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
| |
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<<...
|
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.
|
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...
|
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.
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |