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

📄 item.java

📁 A system to manage a grocery store with a single cash counter.
💻 JAVA
字号:
package grocerystore;

public class Item implements Comparable {
	
	private Product product;
	private int pieces;
	private double finalPrice;
	
	public Item(Product product, int pieces, double price){
		this.product = product;
		this.pieces = pieces;
		this.finalPrice = price;
	}
	public String getDesc() {
		return product.getDesc();
	}
	
	public int getPieces() {
		return pieces;
	}

	public double getPrice() {
		return finalPrice;
	}
	
	public int compareTo(Object o) {
	
		if (!(o instanceof Item)) 
			throw new IllegalArgumentException();
		
		Item item = (Item)o;

		return this.product.getDesc().compareTo(item.product.getDesc());
	} 
}

⌨️ 快捷键说明

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