Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Help with designing a library programme

  1. #1
    Member clarky2006's Avatar
    Join Date
    Nov 2012
    Posts
    84
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Help with designing a library programme

    Hi can anyone help us in designing a library project..im new to java..
    thanx


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help with designing a library programme

    I hate fill-in-the-blank.
    Can we have multiple-choice?

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Help with designing a library programme

    Put down the detail requirements.

  4. #4
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: Help with designing a library programme

    Again, show your code with code tags, and ask your specific questions.

  5. #5
    Member clarky2006's Avatar
    Join Date
    Nov 2012
    Posts
    84
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Re: Help with designing a library programme

    Quote Originally Posted by techiepro View Post
    Put down the detail requirements.
    This is the Library class to implement all the functionality, but really struggled here to integrate it into the rest of the classes. it also goes into an infinite compilation when I compile it.. Its a Uni project and the scenario is this =

    (1) To create a member Class that keeps a basic information about each of its members e.g first name, last name, phone number and each member is also given a unique ID(positive integer)

    (2) To create a book Class. Every book is given a unique positive integer ID which is used to track the loans. The library also records a books Author, Title, and whether its fiction or non-fiction.

    (3) The loan class. A loan is a member borrowing a particular book. So if a member comes in and borrows 3 books its considered 3 loans. the loan period for all books is 3 wks. The library records the membership ID, the book ID number, the date loaned and the date due back. So here we have to add a loan for a given member and book ID numbers. Remove a loan for a given member and book ID numbers. List all loans giving book and member details. This should hold at least 2 attributes, members ID and books ID or member and book object references.

    (4) The library Class should provide all the functionality required to maintain collections of members, books and loans. The library class should have 2 attributes of type ArrayLists one for the members and one for the books. with a constructor to create the arraylists

    Any input would be appreciated guys.. thanx

    --- Update ---

    Quote Originally Posted by clarky2006 View Post
    This is the Library class to implement all the functionality, but really struggled here to integrate it into the rest of the classes. it also goes into an infinite compilation when I compile it.. Its a Uni project and the scenario is this =

    (1) To create a member Class that keeps a basic information about each of its members e.g first name, last name, phone number and each member is also given a unique ID(positive integer)

    (2) To create a book Class. Every book is given a unique positive integer ID which is used to track the loans. The library also records a books Author, Title, and whether its fiction or non-fiction.

    (3) The loan class. A loan is a member borrowing a particular book. So if a member comes in and borrows 3 books its considered 3 loans. the loan period for all books is 3 wks. The library records the membership ID, the book ID number, the date loaned and the date due back. So here we have to add a loan for a given member and book ID numbers. Remove a loan for a given member and book ID numbers. List all loans giving book and member details. This should hold at least 2 attributes, members ID and books ID or member and book object references.

    (4) The library Class should provide all the functionality required to maintain collections of members, books and loans. The library class should have 2 attributes of type ArrayLists one for the members and one for the books. with a constructor to create the arraylists

    Any input would be appreciated guys.. thanx
    /**
     * Write a description of class Book here.
     * 
     * @author (Michael Clark) 
     * @version (30th October 2012, version 0.1)
     */
    public class Book
    {
        // instance variables - replace the example below with your own
        private int id;
        private String author;
        private String title;
        private boolean isFiction;
     
     
        /**
         * Constructor for objects of class Book
         */
        public Book(String title, String author, int id, boolean isFiction)
        {
            // initialise instance variables
            this.id = 0;
            this.author = author;
            this.title = title;
            this.isFiction = false;
        }
     
        /**
         * Get the name of the book Author.
         * 
         */
        public String getAutor()
        {
            // put your code here
            return this.author;
        }
     
        /**
         * Get the book ID.
         */
        public int getId()
        {
            return this.id;
        }
     
        /**
         * Get the book title.
         * 
         */
        public String getTitle()
        {
            return this.title;
        }
     
        public void setAuthor(String authorName)
        {
            author = authorName;
        }
     
        public void setId(int bookId)
        {
            id = bookId;
        }
     
        public void setTitle(String bookTitle)
        {
            title = bookTitle;
        }    
     
    }


    --- Update ---

    import java.util.ArrayList;
    /**
     * This Class would hold Membership details for the Library.
     * 
     * @author (Michael Clark) 
     * @version (30th October 2012, version 0.1)
     */
    public class Member
    {
        // instance variables - These are member object attributes/fields
        private String firstName;
        private String lastName;
        private String phoneNumber;
        private int refNumber;
     
        /**
         * Constructor for objects of class Member
         */
        public Member(String firstName, String lastName, String phoneNumber, int refNumber)
        {
            this.firstName = firstName;
            this.lastName = lastName;
            this.phoneNumber = phoneNumber;
            this.refNumber = refNumber;
     
        }
     
        /**
         * This is return method for the object firstname.
         * 
         */
        public String getfirstName()
        {
             return this.firstName;
        }
     
        /**
         * Return method for the last name.
         */
        public String getlastName()
        {
            return this.lastName;
        }
     
        /**
         * Return method for the phone number.
         */
        public String getPhoneNumber()
        {
            return this.phoneNumber;
        }
     
        /**
         * Return method for membership reference.
         */
        public int getrefNumber()
        {
            return this.refNumber;
        }
    }

    import java.util.ArrayList;
     
    /**
     * This is a model of a Library class.
     * 
     * @author (Michael Clark) 
     * @version (30th October 2012, version 0.1)
     */
    public class Library
    {
        // instance variables  
        private ArrayList<Membership> member;
        private ArrayList<Book> books;
     
        /**
         * Constructor for objects of class Library
         */
        public Library(Membership member)
        {
            // initialise instance variables
            members = new ArrayList<Membership>();
            books = new ArrayList<Book>();
        }

Similar Threads

  1. Designing an Account Class
    By m2msucks in forum What's Wrong With My Code?
    Replies: 16
    Last Post: July 27th, 2014, 06:05 PM
  2. Problem in designing Web Browser
    By Rupinder in forum Java Networking
    Replies: 2
    Last Post: January 29th, 2012, 09:18 PM
  3. What is the best way of designing this object?
    By aussiemcgr in forum Java Theory & Questions
    Replies: 5
    Last Post: May 25th, 2011, 06:38 AM
  4. Problem with designing threads & abstraction
    By gilme in forum What's Wrong With My Code?
    Replies: 6
    Last Post: June 14th, 2010, 06:48 AM
  5. Problem in JSP Page Designing
    By vinothkumarrvk in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: March 10th, 2010, 01:09 AM