goodscar.java

来自「这是一本介绍JSP技术的资料」· Java 代码 · 共 58 行

JAVA
58
字号
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 + =
减小字号Ctrl + -
显示快捷键?