数组存储表格数据练习(未完成)

这是一个关于使用数组存储表格数据的Java练习。博客中创建了一个`Goods`类,包含商品的ID、名称、品牌、价格和折扣信息,并用数组实例化了多个商品对象。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

数组存储表格数据练习(未完成)

在这里插入代码片
  • 数组存储表格数据练习
    */
    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;
}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值