1.:2.:3.:4.:,.,.5.:,,(),.6.:,.7.:.8.:,.9.:.10.:11.:,,.12.:.13.,,.14.:.:,.:void15.final16.AppletAppletjava.awtjava.appletAppletAppletAppletpublicmainAppletjavaAppletHTMLapplet17.classFangcheng{Floata,b,c;fooatx,y;VoidIntfloat(){Iffloatd;d=b*b-4*a*c;if(d0),,,,,,,,18.n23113~10000publicclassJiaoGu{publicstaticvoidmain(String[]args){inti,j;for(j=3;j=10000;j++){i=j;do{if(i%2==0)i=i/2;else{if(i(2147483647-1)/3)i=i*3+1;else{System.out.println();System.exit(0);}}}while(i!=1);}System.out.println();}}importjava.awt.Graphics;importjava.applet.Applet;publicclassJiaoGuextendsApplet{publicvoidpaint(Graphicsg){inti,j;for(j=3;j=10000;j++){i=j;do{if(i%2==0)i=i/2;elsei=i*3+1;}while(i!=1);}g.drawString(,100,100);}}18.publicclassShaizi{publicstaticvoidmain(String[]args){inta,b,i,k=0;for(i=0;i3600;i++){a=(int)(Math.random()*6)+1;b=(int)(Math.random()*6)+1;if(a+b==7)k++;}System.out.println(+k);}}19.appletlongimportjava.awt.*;importjava.applet.Applet;publicclassShuZiextendsApplet{Labelprompt;TextFieldinput;longn=0;publicvoidinit(){prompt=newLabel();input=newTextField(10);add(prompt);add(input);}publicvoidpaint(Graphicsg){longa;intx=0;do{a=n%10;n=n/10;g.drawString(+a,200-x*10,100);x++;}while(n!=0);}publicbooleanaction(Evente,Objecto){n=Long.parseLong(o.toString());repaint();returntrue;}}20.0~10publicclassChengFang{publicstaticvoidmain(String[]args){inti;System.out.printf(\t\t\n);for(i=0;i=10;i++){System.out.printf(%d\t%d\t%d\n,i,i*i,i*i*i);}}}21.appletimportjava.awt.*;importjava.applet.Applet;publicclassSayHelloextendsApplet{Labelprompt;TextFieldinput;intn=0;publicvoidinit(){prompt=newLabel();input=newTextField(5);add(prompt);add(input);}publicvoidpaint(Graphicsg){inti;for(i=0;in;i++)g.drawString(*,20+i*10,80);for(i=0;in;i++)g.drawString(*,20,80+i*10);for(i=0;in;i++)g.drawString(*,20+i*10,80+(n-1)*10);for(i=0;in;i++)g.drawString(*,20+(n-1)*10,80+i*10);}publicbooleanaction(Evente,Objecto){n=Integer.parseInt(input.getText());repaint();returntrue;}}22.intxshow()classA{intx;A(intx){this.x=x;}intshow(){intm,n,s=0;m=x;while(m!=0){n=m%10;m=m/10;s=s*10+n;}returns;}}importjava.applet.Applet;importjava.awt.*;publicclassTestAextendsApplet{Labelprompt;TextFieldinput;publicvoidinit(){prompt=newLabel(:);input=newTextField(6);add(prompt);add(input);}publicvoidpaint(Graphicsg){intx;x=Integer.valueOf(input.getText()).intValue();Aa=newA(x);g.drawString(+a.show(),60,60);}publicbooleanaction(Evente,Objecto){repaint();returntrue;}}23.circleradiusradiusclassCircle{floatradius;Circle(floatr){radius=r;}doublearea(){returnMath.PI*radius*radius;}doublelength(){return2*Math.PI*radius;}}importjava.applet.Applet;importjava.awt.*;publicclassCircleAreaextendsApplet{Labelprompt;TextFieldinput;publicvoidinit(){prompt=newLabel(:);input=newTextField(6);add(prompt);add(input);}publicvoidpaint(Graphicsg){floatr;r=Float.valueOf(input.getText()).floatValue();if(r0)g.drawString(,60,60);else{Circlec=newCircle(r);g.drawString(+c.area(),60,60);g.drawString(+c.length(),60,90);}}publicbooleanaction(Evente,Objecto){repaint();returntrue;}}24.4article,noun,verb,preposition,theaonesomeanyboygirldogtowncardrovejumpedranwalkedskippedtoformoverunderon.article+noun+verb+preposition+article+noun20publicclassSentences{publicstaticvoidmain(String[]args){Stringarticle[]={the,a,one,some,any};Stringnoun[]={boy,girl,dog,town,car};Stringverb[]={drove,jumped,ran,walked,skipped};Stringpreposition[]={to,from,over,under,on};Stringsource[][]=newString[6][];Stringpurpose[]=newString[20];inti,j;source[0]=article;source[1]=noun;source[2]=verb;source[3]=preposition;source[4]=article;source[5]=noun;for(i=0;i20;i++){purpose[i]=newString();for(j=0;j6;j++)purpose[i]+=source[j][(int)(Math.random()*5)]+;System.out.println(purpose[i]);}}}25.2012-11-29November29,2012.importjava.applet.Applet;importjava.awt.*;publicclassDateToStringextendsApplet{Labellab;TextFieldinput;publicvoidinit(){lab=newLabel(2010-10-24);input=newTextField(10);add(lab);add(input);}publicbooleanaction(Evente,Objecto){repaint();returntrue;}publicvoidpaint(Graphicsg){Stringd=input.getText();if(d.length()==0)return;elseif(d.length()!=10||d.charAt(4)!='-'||d.charAt(7)!='-')g.drawString(,100,100);else{Stringyear=d.substring(0,4);Stringday=d.substring(8);Stringmonth;intm=Integer.parseInt(d.substring(5,7));switch(m){case1:month=January;break;case2:month=February;break;case3:month=March;break;case4:month=April;break;case5:month=May;break;case6:month=June;break;case7:month=July;break;case8:month=August;break;case9:month=September;break;case10:month=October;break;case11:month=November;break;case12:month=December;break;default:month=January;}g.drawString(month++day+,+year,100,100);}}}26.CircleclassIllegalRadiusextendsException{publicStringtoString(){return;}}classCircle{floatradius;Circle(floatr)throwsIllegalRadius{if(r0)throw(newIllegalRadius());elseradius=r;}doublearea(){returnMath.PI*radius*radius;}doublelength(){return2*Math.PI*radius;}}importjava.applet.Applet;importjava.awt.*;publicclassUseCircleextendsApplet{Labelprompt;TextFie