不会把,这些程序不难,但是很费时间的。以下是A问题的一个实例,希望你
举一反三,呵呵,我也很菜的。互相学习。import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;public class caculator extends HttpServlet {
    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head>");
out.println("<title>caculator</title>");
        out.println("</head>");
        out.println("<body>");
HttpSession session = request.getSession();
float first,second;
int symbol; if(session.getValue("symbol")!=null)
symbol=Integer.valueOf(session.getValue("symbol").toString()).intValue();
else symbol=0;
if(session.getValue("first")!=null)
first=Float.valueOf(session.getValue("first").toString()).floatValue();
else first=0.0f;
if(session.getValue("second")!=null)
second=Float.valueOf(session.getValue("second").toString()).floatValue();
else second=0.0f; if(request.getParameter("one")!=null)
first=first*10+1;
else if(request.getParameter("two")!=null)
first=first*10+2;
else if(request.getParameter("three")!=null)
first=first*10+3;
else if(request.getParameter("four")!=null)
first=first*10+4;
else if(request.getParameter("five")!=null)
first=first*10+5;
else if(request.getParameter("six")!=null)
first=first*10+6;
else if(request.getParameter("seven")!=null)
first=first*10+7;
else if(request.getParameter("eight")!=null)
first=first*10+8;
else if(request.getParameter("nine")!=null)
first=first*10+9;
else if(request.getParameter("zero")!=null)
first=first*10;
else if(request.getParameter("add")!=null)
{
second=first;
first=0.0f;
symbol=1;
}
else if(request.getParameter("sub")!=null)
{
second=first;
first=0.0f;
symbol=2;
}
else if(request.getParameter("mul")!=null)
{
second=first;
first=0.0f;
symbol=3;
}
else if(request.getParameter("div")!=null)
{
second=first;
first=0.0f;
symbol=4;
}
else if(request.getParameter("equal")!=null)
{
switch(symbol)
{
case 1:
second+=first;
break;
case 2:
second-=first;
break;
case 3:
second*=first;
break;
case 4:
second/=first;
break;
case 0:
break;
default:
break;
}
symbol=5;
}
else  symbol=5;        out.println("<form action=\'' method=\"get\">"); if(symbol==5) {
        out.println("<input type=\"text\" name=\"show\" value="+second+" size=20>");
first=0.0f;
second=0.0f;
symbol=0;
}
else out.println("<input type=\"text\" name=\"show\" value="+first+" size=20>"); session.putValue("first",Float.toString(first));
session.putValue("second",Float.toString(second));
session.putValue("symbol",Integer.toString(symbol));        out.println("<br>");
        out.println("<input type=\"submit\" name=\"one\" value=\" 1 \">");
        out.println("<input type=\"submit\" name=\"two\" value=\" 2 \">");
        out.println("<input type=\"submit\" name=\"three\" value=\" 3 \">");
        out.println("<input type=\"submit\" name=\"four\" value=\" 4 \">");
        out.println("<br>");
        out.println("<input type=\"submit\" name=\"five\" value=\" 5 \">");
        out.println("<input type=\"submit\" name=\"six\" value=\" 6 \">");
        out.println("<input type=\"submit\" name=\"seven\" value=\" 7 \">");
        out.println("<input type=\"submit\" name=\"eight\" value=\" 8 \">");
        out.println("<br>");
        out.println("<input type=\"submit\" name=\"nine\" value=\" 9 \">");
        out.println("<input type=\"submit\" name=\"zero\" value=\" 0 \">");
        out.println("<input type=\"submit\" name=\"add\" value=\" + \">");
        out.println("<input type=\"submit\" name=\"sub\" value=\" - \">");
        out.println("<br>");
        out.println("<input type=\"submit\" name=\"mul\" value=\" * \">");
        out.println("<input type=\"submit\" name=\"div\" value=\" / \">");
        out.println("<input type=\"submit\" name=\"equal\" value=\" = \">");
        out.println("<input type=\"submit\" name=\"recove\" value=\" ce\">");
        out.println("</form>");        out.println("</body>");
        out.println("</html>");
    }
public void doPost(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
{
doGet(request,response);
}
}