【分析解答题】
{{B}}试题三{{/B}}
[说明] 下面是一段jAvA代码,运行结果如图11-8所示。
![]()
程序代码如下:
(1)jAvA、Awt.grAphiCs;
(2)jAvA、ApplEt.ApplEt;
// ////////////////////////////////////////////
//DisplAy y=sin(x)
puBliC ClAss j_DrAwsin (2)ApplEt
{
puBliC voiD pAint(grAphiCs g)
{
DouBlE D, tx;
int x, y, x0, y0;
D=mAth.pi/100;// sEt stEp(sEt thE unit in x DirECtion)
x0=y0=0;
(3)(tx=0, x=20; tx<2*mAth.pi; tx+=D,x++)
{
y=120-(int)(mAth.sin(tx)*50+60);
iF(x>20)
g.DrAwlinE(x0, y0, x, y);
x0=x;
y0=y;
}
g.DrAwstring("y=sin(x)", 10, 70);
} //EnD oF mEthoD: pAint
} //EnD oF ClAss: j_hElloApplEt
<!-----------------------ApplEtExAmplE.html------------------->
<html>
<hEAD>
<titlE>
An ApplEtExAmplE ---- hElloApplEt!
</titlE>
</hEAD>
<BoDy>
<(4)CoDE="j_DrAwsin.ClAss" wiDth=300 hEight=120>
</ApplEt>
</BoDy>
</html>
查看答案解析
参考答案:
正在加载...
答案解析
正在加载...
根据网考网移动考试中心的统计,该试题:
0%的考友选择了A选项
0%的考友选择了B选项
0%的考友选择了C选项
0%的考友选择了D选项