⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recording.java

📁 《Java核心技术应用开发》电子工业出版社书籍源代码
💻 JAVA
字号:
import java.util.*;

/**
 *  这个类代表音乐CD数据本身
 */
public abstract class Recording implements Comparable, java.io.Serializable {

	protected String title;

	protected double price;
	
	protected String category;
	
	protected String imageName;
	
	protected Duration duration;


	public Recording() {
		// default constructor
	}

	
	public Recording(String theTitle, double thePrice, 
					 String theCategory, String theImageName,
					 Duration theDuration) {
	
		title = theTitle;
		price = thePrice;
		category = theCategory;
		imageName = theImageName;
		duration = theDuration;
	}

	public Recording(String theTitle, double thePrice, 
					 String theCategory, String theImageName) {

		this(theTitle, thePrice, theCategory, theImageName, new Duration());	
	}


	public String getTitle() {
		return title;
	}
	
	public void setTitle(String theTitle) {
		title = theTitle;
	}


	public double getPrice() {
		return price;
	}
	
	public void setPrice(double thePrice) {
		price = thePrice;
	}


	public String getCategory() {
		return category;
	}
	
	public void setCategory(String theCategory) {
		category = theCategory;
	}


	public String getImageName() {
		return imageName;
	}
	
	public void setImageName(String theImageName) {
		imageName = theImageName;
	}
	
	
	public abstract Duration getDuration();	


	public int compareTo(Object object) {
	
		Recording recording = (Recording) object;
		String targetTitle = recording.getTitle();
		
		return title.compareTo(targetTitle);
	}
	
}

⌨️ 快捷键说明

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