I am studying a Software Engineering Degree Course in London.I am very keen to learn C++
One of my Units named Programming Methodology and we have been given a coursework during xmas holiday.
I have been trying to sort it out by using internet sources but I am struggling.
Our tutor said that writing program takes 25 minutes but it has been nearly one week I could not even start.
This is my first year and I want to be a good C++ programmer.I dont get the arrays.
I would be very happy if you could solve my problem.
The task is a library program as below.I enclosed two txt file which is relevant to the program.
Regards

Specification
In Smalltown public library, the new head librarian wishes to install a computerised record system to replace the current paper system. There is one computer in the library and it is only used by the library staff.


Currently, there are approximately 1000 books in stock but there is room for twice as many. Each book has a unique six digit book number.

In the current system, the books are categorised as Adventure, Detective, SciFi or Romance and held in the appropriate section of the building. The author, title and book number is indexed on a single card, along with the subject category.

Information is kept on the individual library users in the form of their surname, house number, street name and a user number. Each user number is a unique five digit number. A user may not have more than three books out on loan at any one time. The library has only 500 users at present.

A part-time worker is currently being employed to enter the user data and the book data into the data files.

These data files are available for testing your programs from the following links:

bookdata.txt (see the attached file)
userdata.txt (see the attached file)
Note that these files are accurate but incomplete as the transfer of data from the old system has not yet been completed ( - what important data is missing and why do you think this is? ).

Your program should:

define appropriate user-defined data types to model the data of the application.

read the book data from the book data file and store it in a convenient form.
r

ead the user data from the user data file and store it in a convenient form.

allow a book to be issued to a user or returned by a user.

allow the library staff to list all books by an author, to report which are currently in stock or on loan and to indicate in which area of the library they may be found.

Hello! I've taken the information you've provided and built a small class structure spec. Maybe this will help you progress? If you have any specific questions feel free.

// All fields in book are required to have non-default values.
Book
 o unsigned int uid;
 o unsigned int copies;
 o unsigned int copies_out;
 o string category  //Valid values: Adventure, Detective, SciFi, and Romance
 o string author;
 o string title;

// All fields in User are required to have non-default values.
User
 o unsigned int uid;
 o string surname;
 o int street_number;
 o string street_name;


// Neither pointer may ever be null.
CheckedOut
  o User* user;
  o Book* book;

Library
  o vector<User> users;
  o vector<Book> books;
  o vector<CheckedOut> checkout_log;

  // lookupUser returns a pointer to a users 
  // entry based on their ID, if none exists then
  // NULL is returned.
  o User* lookupUser(unsigned u_id)

  // checkOutBook accepts a user ID and a book ID,
  // if both are valid and there are copies of the book
  // remaining and the user does not currently have 3
  // books out, then it creates an entry in the CheckedOut log.
  o checkOutBook(unsigned u_id, unsigned b_id )          

  // returnBook accepts a user ID and a book ID, 
  // if both are valid and the user specified currently has
  // the book specified checked out it removes that entry from
  // the checked out log and decrements the books copies_out
  // field. If copies_out is at 0 then do not decrement, but alert
  // the user to possible data corruption. Still remove the 
  // checkedOut log in that instance.
  o returnBook(unsigned u_id, unsigned b_id )

  // readFromFile allows you to read a properly formatted
  // text file and either use that as the working database, 
  // or append your current working database with the new records.
  // Appended data will be verified for referential integrity. If
  // there are validation errors anywhere in the file, no records
  // will be added and the user will be alerted. This is auto-
  // matically done in the ctor, with the append option off.
  o readFromFile(string filename, bool append = false)

  // writeToFile acccepts a filename and writes the entire
  // database to a text file. This is done automatically in the
  // destructor, but can be called at will too.
  o writeToFile(string filename)

Cheers,
Ninwa

Another homework dump, a verbatim copy and paste straight from the assignment sheet, with nothing to suggest the OP has put any thought at all into it. If you are a first year C++ student, your tutor is high. Ignore the 25 minute estimate completely. It'll take you that long just to plot out an approach to the problem and sketch what is needed before typing a single line of code. But you need to show at least SOMETHING in the way of effort before you ask for help. Make a menu or a class or struct or something.

I agree with Vernon.

> This is my first year and I want to be a good C++ programmer.I dont get the arrays.
> I would be very happy if you could solve my problem.
You're screwed then.
You'll never be good at anything (even flipping burgers) without putting in the practice.

Unless you're OK with "Happy" == "Ignorant".

Dear Ninwa
Thanks for your reply but still I can not write the whole coding structure which I needed.It doesn't make any sense to me.
I shoud be able to compile and run it in order to see how it works.
I would be very happy if you could write the codes from A to Z with detailed explanations.
Regards
ADAM

Dear Ninwa
Thanks for your reply but still I can not write the whole coding structure which I needed.It doesn't make any sense to me.
I shoud be able to compile and run it in order to see how it works.
I would be very happy if you could write the codes from A to Z with detailed explanations.
Regards
ADAM

Not gonna happen this is not your homework solution lounge.
It's a guidance forum!

Chris

commented: Absolutely +25

Dear Ninwa
Thanks for your reply but still I can not write the whole coding structure which I needed.It doesn't make any sense to me.
I shoud be able to compile and run it in order to see how it works.
I would be very happy if you could write the codes from A to Z with detailed explanations.
Regards
ADAM

Salem's highlighting of "you" last time didn't have any effect, so I figured I'd highlight it again. I always wonder with these kinds of posts whether they are real requests or merely trolling to get a rise out of people. I've always had a certain amount of awe for people with the audacity to ask perfect strangers to do all of their work for free while being perfectly frank up front that they don't have any plans at all to do any of the work themselves.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.