recording.java

来自「ssd3的教程 是我们老师给我们的 纯英文 有兴趣的可以」· Java 代码 · 共 72 行

JAVA
72
字号
/**
 * This class models a recording. It extends {@link CatalogItem} and
 * adds the following information:
 * <ol>
 * <li>the performer of the recording, a <code>String</code></li>
 * <li>the format of the recording, a <code>String</code></li>
 * </ol>
 *
 * @author author name
 * @version  1.0.0
 * @see CatalogItem
 */
public class Recording extends CatalogItem  {

    /* Performer of the recording. */
    private String performer;

    /* Format of the recording. */
    private String format;

    /**
     * Constructs an <code>Recording</code> object.
     *
     * @param initialCode  the code of the catalog item.
     * @param initialTitle  the title of the catalog item.
     * @param initialYear  the year of the catalog item.
     * @param initialPerformer  the performer of the recording.
     * @param initialFormat  the format of the recording.
     */
    public Recording(String initialCode, String initialTitle,
                     int initialYear, String initialPerformer,
                     String initialFormat) {

        super(initialCode, initialTitle, initialYear);

        performer = initialPerformer;
        format = initialFormat;
    }

    /**
     * Returns the performer of this recording.
     *
     * @return  the performer of this recording.
     */
    public String getPerformer() {

        return performer;
    }

    /**
     * Returns the format of this recording.
     *
     * @return  the format of this recording.
     */
    public String getFormat() {

        return format;
    }

    /**
     * Returns the string representation of this recording.
     *
     * @return  the string representation of this recording.
     */
    public String toString()  {

        return  super.toString() + "_" + getPerformer() + "_"
                + getFormat();
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?