88 lines
2.0 KiB
Java
88 lines
2.0 KiB
Java
|
|
/**
|
|
* Write a description of class LibraryUser here.
|
|
*
|
|
* @author (your name)
|
|
* @version (a version number or a date)
|
|
*/
|
|
|
|
import java.util.Scanner;
|
|
import java.io.PrintWriter;
|
|
|
|
public class LibraryUser
|
|
{
|
|
// instance variables - replace the example below with your own
|
|
private String userID, surname, firstName, otherInitials, title;
|
|
|
|
/**
|
|
* Constructor for objects of class LibraryUser
|
|
*/
|
|
public LibraryUser(){}
|
|
|
|
public String getUserID(){
|
|
return userID;
|
|
}
|
|
|
|
public String getSurname(){
|
|
return surname;
|
|
}
|
|
|
|
public String getFirstName(){
|
|
return firstName;
|
|
}
|
|
|
|
public String getOtherInitials(){
|
|
return otherInitials;
|
|
}
|
|
|
|
public String getTitle(){
|
|
return title;
|
|
}
|
|
|
|
|
|
|
|
public void setUserID( String userID ){
|
|
this.userID = userID;
|
|
}
|
|
|
|
public void setSurname( String surname ){
|
|
this.surname = surname;
|
|
}
|
|
|
|
public void setFirstName( String firstName ){
|
|
this.firstName = firstName;
|
|
}
|
|
|
|
public void setOtherInitials( String otherInitials ){
|
|
this.otherInitials = otherInitials;
|
|
}
|
|
|
|
public void setTitle( String title ){
|
|
this.title = title;
|
|
}
|
|
|
|
public void writeData( PrintWriter writer )
|
|
{
|
|
writer.print(userID + ", " + surname + ", " + firstName + ", " + otherInitials + ", " + title + "\n");
|
|
writer.flush();
|
|
}
|
|
|
|
public void printDetails()
|
|
{
|
|
System.out.println( "ID: " + userID +
|
|
"\nName: " + title + " " + firstName + " " + otherInitials + " " + surname );
|
|
}
|
|
|
|
public void readData( Scanner detailScanner )
|
|
{
|
|
if ( detailScanner != null ) {
|
|
this.userID = detailScanner.next().trim();
|
|
this.surname = detailScanner.next().trim();
|
|
this.firstName = detailScanner.next().trim();
|
|
this.otherInitials = detailScanner.next().trim();
|
|
this.title = detailScanner.next().trim();
|
|
}
|
|
}
|
|
|
|
}
|