vault backup: 2024-03-05 16:01:50

This commit is contained in:
2024-03-05 16:01:50 +00:00
parent 8ce640b4ba
commit 28ea6a0a9b
36 changed files with 314 additions and 89 deletions

View File

@@ -1,9 +1,9 @@
/**
* Write a description of class LibraryUser here.
* Class LibraryUser to create a user of a library.
*
* @author (your name)
* @version (a version number or a date)
* @George Wilkinson
* @1.0
*/
import java.util.Scanner;
@@ -11,7 +11,7 @@ import java.io.PrintWriter;
public class LibraryUser
{
// instance variables - replace the example below with your own
// instance variables
private String userID, surname, firstName, otherInitials, title;
/**
@@ -19,6 +19,9 @@ public class LibraryUser
*/
public LibraryUser(){}
/*
* Accessor start - return values of corresponding variables.
*/
public String getUserID(){
return userID;
}
@@ -39,8 +42,11 @@ public class LibraryUser
return title;
}
/*
* Accessor End
* Mutator Start - Set value of corresponding variables
*/
public void setUserID( String userID ){
this.userID = userID;
}
@@ -61,18 +67,31 @@ public class LibraryUser
this.title = title;
}
/*
* Mutator End
*/
/*
* Passed a PrintWriter, append field variables in a set format, and flush the buffer.
*/
public void writeData( PrintWriter writer )
{
writer.print(userID + ", " + surname + ", " + firstName + ", " + otherInitials + ", " + title + "\n");
writer.flush();
}
/*
* Print to terminal, all relevant fields.
*/
public void printDetails()
{
System.out.println( "ID: " + userID +
"\nName: " + title + " " + firstName + " " + otherInitials + " " + surname );
}
/*
* Passed a scanner object, assign relevant values to field variables.
*/
public void readData( Scanner detailScanner )
{
if ( detailScanner != null ) {