package Goods;
public class Goods {
private String number;
private String name;
private double price;
private int count;
public Goods() {
}
public Goods(String number, String name, double price, int count) {
this.number = number;
this.name = name;
this.price = price;
this.count = count;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
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 getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}
package Tool;
import Goods.Goods;
public class AboutGoods {
private AboutGoods(){}
public static Goods setGood(Goods g , String number , String name , double price , int count){
g.setNumber(number);
g.setName(name);
g.setPrice(price);
g.setCount(count);
return g;
}
public static void getGood(Goods g){
System.out.println(g.getNumber() + " " +g.getName()+ " " +g.getPrice()+ " " +g.getCount());
}
}
package Test;
import Goods.Goods;
import Tool.AboutGoods;
public class test {
public static void main(String[] args) {
Goods g1 = new Goods();
AboutGoods.setGood(g1,"001","雪碧",2.5,20);
AboutGoods.getGood(g1);
}
}