太原理工大学软件java实验报告(20)
发布时间:2021-06-12
发布时间:2021-06-12
{
System.out.println("请输入商品数量");
goods.setNumber(Integer.parseInt(readString())); i = 0; }
catch (Exception e) { i = 1;
System.err.println("输入有误"); }
}while (i != 0); do { try {
System.out.println("请输入商品产地"); goods.Producer(readString()); i = 0; }
catch (Exception e) { i = 1;
System.err.println("输入有误"); }
} while (i != 0);
System.out.println(market.append(goods));
break; case 2:
System.out.println("请输入要删除商品的名称"); String name = readString();
System.out.println(market.delete(name)); break; case 3:
System.out.println("商品名称\t商品价格\t商品数量"); for (int j = 0; j < market.getGoodsList().size(); j++) {
Goods g = market.getGoodsList().get(j);
System.out.println(g.getName() + "\t" + g.getPrice() + "\t" + g.getNumber()); } break;
上一篇:宜春一对一辅导机构哪家好