Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   need help (http://www.go4expert.com/forums/need-help-t1707/)

hing 23Oct2006 14:16

need help
 
hey there guys... am trying to complete my project which is to create a Library System. Was able to create a list to show the books available when they select the book and click a borrow button it can print out the book.

what problem i have now is that when a student click borrow... the value how can i transfer to an array inside the object student.

i am usin a main screen (ms) who is controlling all the functions. been trying and trying on this for very long hopefully there will be those who are able to help me out.

my customer screen would be like this... but how can i add in the array for books borrowed

Code:



import javax.swing.*;
class Customer
{
        private String name;
        private int accNo;
        private String password;
        private double balance;
        private String borrow;
        static int borrowCount=0;
        static int customerCount=0;
        private MainScreen ms;
       
        Customer(String n, int no, String p, double b)
        {
                name=n;
                accNo=no;
                password=p;
                balance=b;
                customerCount++;
                JOptionPane.showMessageDialog(null,name +" record created");
                display();
        }
       
        public String setStudentBorrow(String a)
        {
                borrow=a;
                borrowCount++;
                JOptionPane.showMessageDialog(null,"Book Borrowed");
        }
       
        public String getStudentBorrow()
        {        return borrow;        }
       
        /*public String setBorrow(String a)
        {
                borrow[borrowCount]=a;
                borrowCount++;       
        }
       
        public String getBorrow()
        {        for (int i=0;i<5;i++)
                {
                        return borrow[i];
                }
        }*/
       
        public String getPassword()
        {        return password;        }
       
        public String getName()
        {        return name;                }
       
        public int getAccNo()
        {        return accNo;        }
       
        public double getBalance()
        {        return balance;        }
       
        public void setName(String n)
        {        name=n;        }
       
        public void setPassword(String p)
        {        password=p;        }
       
        public void setBalance(double b)
        {        balance=b;        }
       
        public void setAccNo(int no)
        {        accNo=no;        }
       
       
        public void display()
        {
                JOptionPane.showMessageDialog(null,
                //"\nCutomer Number : "+ customerCount+
                "\nName :"+name+
                "\nAccount Number: "+accNo+
                "\nBalance (RM): "+balance,"Customer record",
                JOptionPane.INFORMATION_MESSAGE        );
        }
}


shabbir 23Oct2006 14:47

Re: need help
 
You have posted it as an Article under the Article / Source code section. I have moved it to the Queries and Discussion forum.

Duplicate of need help !!! urgent. Thread Closed.


All times are GMT +5.5. The time now is 18:28.