vault backup: 2024-03-05 16:01:50
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
|
||||
/**
|
||||
* Write a description of class CD here.
|
||||
* Subclass of AudioVisual, to create objects of a CD.
|
||||
*
|
||||
* @author (your name)
|
||||
* @version (a version number or a date)
|
||||
* @George Wilkinson
|
||||
* @1.0
|
||||
*/
|
||||
|
||||
import java.util.Scanner;
|
||||
@@ -15,35 +15,54 @@ public class CD extends AudioVisual
|
||||
|
||||
/**
|
||||
* Constructor for objects of class CD
|
||||
* Since all field variables initialise as null, nothing should happen here.
|
||||
*/
|
||||
public CD(){}
|
||||
|
||||
/*
|
||||
* Return value of @artist.
|
||||
*/
|
||||
public String getArtist()
|
||||
{
|
||||
return artist;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return value of @noOfTracks
|
||||
*/
|
||||
public int noOfTracks()
|
||||
{
|
||||
return noOfTracks;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set value of @artist.
|
||||
*/
|
||||
public void setArtist( String artist )
|
||||
{
|
||||
this.artist = artist;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set value of @noOfTracks.
|
||||
*/
|
||||
public void setNoOfTracks( int noOfTracks )
|
||||
{
|
||||
this.noOfTracks = noOfTracks;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print to terminal, relevant details of current object.
|
||||
*/
|
||||
public void printDetails() {
|
||||
System.out.println( "Artist: " + artist +
|
||||
"\nTrack Count: " + noOfTracks );
|
||||
super.printDetails();
|
||||
}
|
||||
|
||||
/*
|
||||
* Passed a scanner, set the relevant details to their corresponding field variables.
|
||||
*/
|
||||
public void readItemData( Scanner detailScanner ){
|
||||
if ( detailScanner != null ) {
|
||||
this.artist = detailScanner.next().trim();
|
||||
|
Reference in New Issue
Block a user