57 lines
1.3 KiB
Java
57 lines
1.3 KiB
Java
|
|
/**
|
|
* Subclass of LibraryItem to create a periodical ( e.g. newspaper, tabloid ).
|
|
*
|
|
* @George Wilkinson
|
|
* @2.5
|
|
*/
|
|
|
|
import java.util.Scanner;
|
|
|
|
public class Periodical extends PrintedItem
|
|
{
|
|
private String publicationDate;
|
|
|
|
/**
|
|
* Constructor for objects of class Periodical
|
|
* Since all field variables initialise as null, nothing should happen here.
|
|
*/
|
|
public Periodical(){}
|
|
|
|
/*
|
|
* Return value of @publicationDate
|
|
*/
|
|
public String getPublicationDate()
|
|
{
|
|
return publicationDate;
|
|
}
|
|
|
|
/*
|
|
* Set value of @publicationDate
|
|
*/
|
|
public void setPublicationDate( String publicationDate )
|
|
{
|
|
this.publicationDate = publicationDate;
|
|
}
|
|
|
|
/*
|
|
* Print to terminal, relevant field variable's values.
|
|
*/
|
|
public void printDetails() {
|
|
System.out.println( "Publication Date: " + publicationDate );
|
|
super.printDetails();
|
|
}
|
|
|
|
/**
|
|
* Populate the fields with details from the scanner
|
|
* Takes Parameters
|
|
* Scanner @detailScanner
|
|
*/
|
|
public void readItemData( Scanner detailScanner ){
|
|
if ( detailScanner != null ) {
|
|
this.publicationDate = detailScanner.next().trim();
|
|
super.readItemData( detailScanner );
|
|
}
|
|
}
|
|
}
|