数组存储表格数据练习(未完成)
在这里插入代码片
- 数组存储表格数据练习
*/
package cn.wu.array;
import java.util.Arrays;
public class Exe4 {
public static void main(String[] args) {
Goods[] gss = {
new Goods(1,“鼠标”,“BZ_001”,99.21,0.9),
new Goods(2,“键盘”,“WQ_102”,209.5,0.7),
new Goods(3,“显示器”,“BK_001”,1025.6,0.8),
new Goods(4,“主机”,“GQ_XF_12”,4005.8,0.5),
new Goods(5,“内存条”,“DM_PH_13”,200.0,0.3)
};
// Goods Dp = new Goods(price,dicunt);
System.out.println(Arrays.deepToString(gss));
}
}
class Goods {
private int id;
private String name;
private String marque;
private double price;
private double dicount;
public Goods() {
}
@Override
public String toString() {
return "Goods [id:" + id + ", name:" + name + ", marque:" + marque + ", price:" + price + ", dicount:" + dicount
+ "]";
}
public Goods(int id, String name, String marque, double price, double dicount) {
super();
this.id = id;
this.name = name;
this.marque = marque;
this.price = price;
this.dicount = dicount;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMarque() {
return marque;
}
public void setMarque(String marque) {
this.marque = marque;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getDicount() {
return dicount;
}
public void setDicount(double dicount) {
this.dicount = dicount;
}
}
使用数组存储表格数据实践
这是一个关于使用数组存储表格数据的Java练习。博客中创建了一个`Goods`类,包含商品的ID、名称、品牌、价格和折扣信息,并用数组实例化了多个商品对象。
&spm=1001.2101.3001.5002&articleId=117718457&d=1&t=3&u=fef8168c03c64ef09489f18409cef1d1)
69

被折叠的 条评论
为什么被折叠?



