• 下面Applet程序的功能是统计在平面坐标系第一象限中,半径大于9,小于10的圆环中坐标值为整数的点有多少?并且给出其坐标值。请改正程序中的错误(有下画线的语句),使程序执行后,能得到预期的结果。
    import java.awt.*;
    import java.applet.*;
    /*
    <applet code=Di9Ti width=200 height=100>
    </applet>
    */
    public class Di9Ti extends Applet
    {
    public void paint(Graphics g)
    {
    int x,y,r1=5,r2=4;
    int count=0;
    for(x=1;x<y;x++)
    {
    for(y=1;y<r1;y)
    {
    if(x*x+y*y<=r2*r2||x*x+y*y>=r1*r1)
    break;
    g.drawStdng("x="+x+"y="+y,20+count*80,20);
    count++;
    }
    }
    g.drawString("count="+count,20,40);
    }
    }
    ex11_3.html:
    <html>
    <head>
    <title>A Simple Program</title>
    </head>
    <body>
    <applet code="Di9Ti.class"width=800 height=400>
    </applet>
    </body>
    </html>

    正确答案:xr1;     y++     continue;xr1;     y++     continue;
  • 2021年07月14日 22时32分来自  问答库 >> 计算机类
  • 评论 0
  • 手机玩微博

    手机版 手机端
    Powered by 日新微博 © 2018 - 2020 日新网