📄 goods.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 + -