CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Guil problem

  1. #1
    Join Date
    Jan 2010
    Posts
    3

    Guil problem

    Hello ,

    I've a java problem from my collage studies to challange myself that i can't really handle myself so please if you could take a quick look i would be very gratefull =)

    the problem inc in a wall of text
    --------------------------------

    In this problem, you are asked to write a book checking out system for a library. The library software will have a GUI that enables the librarian to check out library books and to return them. The library software should also allow the librarian to enter a new book that is added to the library collection.

    You should write Java classes that represent

    - a Book
    o its title (a String)
    o its ISBN number (a String that fits the ISBN format)
    o its Dewey decimal number (“QA 76.141.2 v1” for example. This is a String that uniquely identifies every separate copy of every book.)
    o for how many days it can be checked out for (an integer)
    o get and set methods with validity checking for all fields
    o constructors as necessary

    - a check-out record (CheckOutRecord)
    o the name of the person that checked out the book (a String)
    o the check out date (a Date object)
    o the due date (a Date object)
    o the Dewey decimal number of the book that was checked out

    The library software should make use of two ArrayList’s, one storing the list of Books sorted by its Dewey decimal code, the other one storing the CheckOutRecords.

    The software should also use two object files, one storing the ArrayList of Book’s, the other storing the ArrayList of check out records. Whenever a book is added, checked out or returned, these files should be updated along with the corresponding ArrayLists’s. These files should have fixed names. The user should not select the names of these files.

    --------------------
    thanks again =)

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Guil problem

    So, I've taken a quick look - now what?

    The truth is, when all is said and done, one does not teach a subject, one teaches a student how to learn it. Teaching may look like administering a dose, but even a dose must be worked on by the body if it is to cure. Each individual must cure his or her own ignorance...
    J. Barzun
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Oct 2008
    Posts
    77

    Re: Guil problem

    now if you could just solve it

  4. #4
    Join Date
    Apr 2007
    Posts
    425

    Re: Guil problem

    ok i've solved it - now what?
    ------
    If you are satisfied with the responses, add to the user's rep!

  5. #5
    Join Date
    Feb 2008
    Posts
    966

    Re: Guil problem

    now if u cud plz send meh teh codez

  6. #6
    Join Date
    Jan 2010
    Posts
    3

    Re: Guil problem

    Hello again,
    sorry if im being understanded on the wrong side , i don't need codes i just need a explanationary guide by like writing (not coding) how could i solve this which methods should i use for example the "Dewey decimal number" how and where should i attach it to be found while tracking.

  7. #7
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Guil problem

    The whole point of exercises like this is that you try to understand what the question is asking, then try to figure out the answer yourself. Programming is all about problem solving. Writing the code is just part of it - some thought is also required.

    In this case, you're given the class names and contents, what to store them in, and how to sort them.

    If you write the classes and as much of the working of the main program as you can, then post up any code you're stuck on, and explain what you're having difficulty with, we'll help you to fix it.

    The truth is, when all is said and done, one does not teach a subject, one teaches a student how to learn it. Teaching may look like administering a dose, but even a dose must be worked on by the body if it is to cure. Each individual must cure his or her own ignorance...
    J. Barzun
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  8. #8
    Join Date
    Jan 2010
    Posts
    3

    Re: Guil problem

    The code for my problem is the following that i couldnt manage to make the layouts as north and south and also couldnt manage to add the drop down list,

    [import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;

    public class LibaryGui extends JFrame{

    private BorderLayout layout1;
    private JList drop_list;
    private JButton button_checkout = new JButton("Checkout");
    private JButton button_add = new JButton("Add");
    private JTextField Studen_name = new JTextField("Student name");
    private JTextField check_out_date = new JTextField("Check out date");
    private JTextField ISBN_number = new JTextField("ISBN number");
    private JTextField Dewey_number = new JTextField("Dewey number");
    private JTextField book_name = new JTextField("Book Title");

    public LibaryGui(){


    book[] bookArray = new book[50];
    CheckOutRecord[] checkArray = new CheckOutRecord[50];

    drop_list = new JList( bookArray );
    drop_list.setVisibleRowCount( 5 );
    drop_list.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );


    layout1 = new BorderLayout(5,5);
    setLayout(layout1);

    JPanel panel = new JPanel();

    panel.add(Studen_name, BorderLayout.NORTH);
    panel.add(button_checkout, BorderLayout.NORTH);
    panel.add(book_name, BorderLayout.SOUTH);
    panel.add(ISBN_number, BorderLayout.SOUTH);
    panel.add(Dewey_number, BorderLayout.SOUTH);
    panel.add(check_out_date, BorderLayout.SOUTH);
    panel.add(button_add, BorderLayout.SOUTH);
    panel.add(drop_list,BorderLayout.NORTH );

    layout1 = new BorderLayout(5,5);
    setLayout(layout1);

    add(panel);

    button_checkout.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("");
    }
    });
    button_add.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("");
    }
    });
    }
    public static void main(String[] args) {

    LibaryGui frame = new LibaryGui();
    frame.setTitle("Library Program");
    frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    frame.setSize( 500, 250 );
    frame.setVisible( true );

    }
    }]

  9. #9
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Guil problem

    You're supposed to add the layout to the panel you're laying out the components in.

    Why couldn't you manage to add the drop down list? You created the list, so what's the problem?

    Language serves not only to express thought but to make possible thoughts which could not exist without it...
    B. Russell
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured