need help !!! urgent

Discussion in 'Java' started by hing, Oct 23, 2006.

  1. hing

    hing New Member

    Joined:
    Oct 23, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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	);
    	}
    }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice