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

📄 goods.java

📁 用JAVA实现购物框程序,通过对JAVA面向对象思想的深入理解,采用JAVABEAN思想设计了GOOD类,又采用了MVC设计模式,实现了各个功能的分离,提高了代码的可读性和可重用性!
💻 JAVA
字号:
package shoppingBasket;

public class Goods {

	private String name ;
	private float price;
	private int count;

	public int getCount() {
		return count;
	}


	public void setCount(int count) {
		this.count = count;
	}


	public Goods() {
		// TODO Auto-generated constructor stub
	}
	

	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public float getPrice() {
		return price;
	}


	public void setPrice(float price) {
		this.price = price;
	}
	public void increase(){
		this.setCount(this.getCount()+1);
	}
	public void drop(){
		this.setCount(this.getCount()-1);
	}


	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}


	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return this.name+" "+this.price+" "+this.count;
	}
	

	
	public boolean equals(Goods goods){
		if(name.equalsIgnoreCase(goods.name)){
				if(price==goods.price){
					return true;
				}
				return false;
			}
			return false;
	}
	

}

⌨️ 快捷键说明

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