Trying to build a library system..

B

Becky

Hi All..

I'm trying to write a program in java that would look something like
the following:


======================
Welcome to your Library
======================

Creating catalogue.... Done
Populating catalogue.... Done
The current books in the catalogue are:

Title: The Truth
Author: Terry Pratchett
Year: 2000

Title: The Hitchhikers Guide to the Galaxy
Author: Douglas Adams
Year: 1995

Title: The Root of all Evil
Author: JD Frazer
Year: 2001


to build it I was thinking of having three classes: Library (used to
drive the program), Catalogue and Book..
I don't know if I'm in the right track, but in the Library class, have
method filldata() which would create an instance of catalogue and
populate the catalogue and print it..

In the catalogue class have methods such as addbook(), getbook(), and
printCatalogue(), which will talk to and get information from Books
class..

Has anyone ever written something similar? If not, I'm sure it's not
very hard to do, if someone could perhaps write the backbone of the
program and I'll finish up the specifics.. It'd be very helpful..

Thanks..


bec.
 
S

Solar

I thought the purpose of homework assignments was for you to do them
yourself. If its not very hard to do, I'm sure you'll have no problem
doing it :)

-- Matt
 
R

Roedy Green

In the catalogue class have methods such as addbook(), getbook(), and
printCatalogue(), which will talk to and get information from Books
class..

Just think in English.

I have a Book class. What facts do I want to keep about each book.
Make a field for each one, a getter and setter.

I have a Calalogue. It is a Collection of books. You want to look up
by what? You might use a HashMap to look up by ISBSN, Treeset by
author last name. you might have keywords you look up by HashMap or
TreesSet

If you track circulation you have a Borrower record. Again set up the
relevant fields.

The Borrower has a minicollecition of books he has out.
You might have a BorrowedBook class that extends book that tracks who
has it out and when it is due back.

Now you think about what fields change when a borrower borrows a book,
brings one back.

You can invent the lookup methods in the catalo, given x you get back
a list of looks.

Now you have to think about persistence. You can simply load
everything into ram and save it all with serialised objects. Or you
can use a database (how you would do it in real life) or a POD.

It depends on just how real this exercise is expected to be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top