before you go to sleep..it's better I tell you something
first I think we need here three base classes for Users,Books,managing the libraray
here this is the firs class(it's not complete)....
Have a look at it anyway...
=============================================
public class User
{
private int userID;
private string firstname;
private string lastname;
private string phonenumber;
private string address;
private DateTime DateUserBorrowed;//the date user borrows the book
private DateTime DateUserBrought;//the date user brings back the book
public Book TheLastBook;//current book or the last book the user has borrowed
public static int count;
public int a;
private Stack ListOfBooksBorrowed=new Stack();//this stack shows all books this user borrowed
public User()
{
}
public User(int UserID,string FirstName,string LastName,string PhoneNumber,string Address)
{
this.userID=UserID;
this.firstname=FirstName;
this.lastname=LastName;
this.phonenumber=PhoneNumber;
this.address=Address;
count++;//a static vaiable when evry instances created increases one unit
}
public int GetUserID()
{
return this.userID;
}
public string GetFirstName()
{
return this.firstname;
}
public string GetLastName()
{
return this.lastname;
}
public string GetPhoneNumber()
{
return this.phonenumber;
}
public string GetAddress()
{
return this.address;
}
public void PrintProperties()
{
//this prints all the fields on screen
}
public DateTime GetDateUserBorrowed()
{
return this.DateUserBorrowed;
}
public DateTime GetDateUserBrought()
{
return this.DateUserBrought;
}
public void SetDateUserBorrowed(int year,int month,int day)
{
this.DateUserBorrowed=new DateTime(year,month,day);
}
public void SetDateUserBrought(int year,int month,int day)
{
this.DateUserBrought=new DateTime(year,month,day);
}
public bool HasBorrowedAnyBook()
{
bool result=true;
if(TheLastBook==null) result=false;
return result;
}
public int fine()
{
DateTime now=DateTime.Now;
if(!this.HasBorrowedAnyBook())return 0;//not complete
}
}
=====================================
any better opinion greatly appreciated
--------------------------------------------
Mehdi.:)
|