要封装的属性
id;
name;//商品名称
city;//产地
price;//价格
number;//库存
picture;//商品图片
封装完了加上无参构造方法然后再加上
public Items(int id,String name,String city,int price,int number,String picture){
this.id=id; this.name=name; this.city=city;this.picture=picture;
this.price=price;
this.number=number;}
id;
name;//商品名称
city;//产地
price;//价格
number;//库存
picture;//商品图片
封装完了加上无参构造方法然后再加上
public Items(int id,String name,String city,int price,int number,String picture){
this.id=id; this.name=name; this.city=city;this.picture=picture;
this.price=price;
this.number=number;}
2017-04-19
注意啦!!!!
sum +=i.getPrice()*goods.get(i);这里报错的同学在Items.java 里封装一下price
它是保存单个商品的数值 设置为 private double price; 然后set get.
sum +=i.getPrice()*goods.get(i);这里报错的同学在Items.java 里封装一下price
它是保存单个商品的数值 设置为 private double price; 然后set get.
2017-04-19