📄 goodscar.java
字号:
package bcs;
import java.util.*;
import java.io.*;
public class GoodsCar implements Serializable
{ Hashtable list=new Hashtable();
String item="";
int mount=0;
String unit="";
public GoodsCar()
{
}
public void setItem(String newItem)
{
try{
item=new String(newItem.getBytes("ISO8859_1"));
}
catch(Exception e)
{
}
}
public void setUnit(String newUnit)
{
try{
unit=new String(newUnit.getBytes("ISO8859_1"));
}
catch(Exception e)
{
}
}
public void setMount(int m)
{mount=m;}
public void addGoodstoCar()
{
String str="商品名称:"+item+" 数量:"+mount+"单位:"+unit;
try{
String things=new String(str.getBytes("GB2312"));
list.put(item,things);
}
catch(Exception e)
{}
}
public Hashtable listGoods()
{
return list;
}
public void deleteGoods(String s)
{
try{
String DeleteItem=new String(s.getBytes("GB2312"));
list.remove(DeleteItem);
}
catch(Exception e)
{}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -