45 lines
753 B
Java
45 lines
753 B
Java
package chapter6.demo61;
|
|
|
|
/**
|
|
* 商品类
|
|
*/
|
|
public class Goods {
|
|
private String name;
|
|
private double price;
|
|
private int num;
|
|
|
|
public Goods(String name, double price, int num) {
|
|
this.name = name;
|
|
this.price = price;
|
|
this.num = num;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public double getPrice() {
|
|
return price;
|
|
}
|
|
|
|
public void setPrice(double price) {
|
|
this.price = price;
|
|
}
|
|
|
|
public int getNum() {
|
|
return num;
|
|
}
|
|
|
|
public void setNum(int num) {
|
|
this.num = num;
|
|
}
|
|
|
|
public String toString() {
|
|
return name + "\t" + price + "\t" + num;
|
|
}
|
|
}
|