没有合适的资源?快使用搜索试试~ 我知道了~
java上机习题java上机习题.doc
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 22 浏览量
2022-06-09
19:19:02
上传
评论
收藏 112KB DOC 举报
温馨提示
试读
16页
java上机习题java上机习题
资源推荐
资源详情
资源评论
2.1 Write an application that reads three integers and prints their average.
!"请输入三个整数:"
#$!
#%&
#%&
#%&
#''()
!"平均值为:"'
*
*
2.2 Write an application that converts miles to kilometers. (One mile equals
1.60935 kilometers.) Read the miles value from the user as a floating point
value.
+,#-./)0
!"请输入英里数:"
#$!
#%&
#1,
!"平均值为:"''"2"
*
*
2.3 Write an application that prompts for and reads an integer representing the
length of a square’s side, then prints the square’s perimeter and area.
!"正方形边长:"
#$!
#%&
#13
#1
!"周长为:"''"4 面积为:"'
*
*
2.4 Create a revised version of the Snowman applet with the following
modification:
Add two red buttons to the upper torso
Make the snowman frown instead of smile
Move the sun to the upper-right corner of the picture
Display your name in the upper-left corner of the picture
Shift the entire snowman 20 pixels to the right
$5
$67
%$89
$%89
:;
67
+<&=#0.'>.
+;?#0.
@25!
55
+A.B0)..0.
55!$
+;>...C.C.
55$7
+;<&=D>.;?3.3.
+;<&=D)0;?')0B.0.
+;<&=D0.;?'C...-.
55
+;<&=D0;?'0...
+;<&=D0;?'-...
552
+;<&=D.;?'.00
+;<&='0;?'.00
$9<&=D.;?'>.>..-.>.
$E<&=D>0;?'-.<&=D0.;?'3.
$E<&='>0;?'-.<&='00;?'-.
$E<&=D>.;?'0<&='>.;?'0
+A<&=D0;?D>.).>0
$"孙婉月"..
*
*
3.1 Write an application that creates and prints a random phone number of the
form XXX-XXX-XXXX. Include the dashes in the output. Do not let the first
three digits contain an 8 or 9 and make sure that the second set of three digits is
not greater that 742.
A
%)
A#$A
>)30
#%&C
>#%&C
)#%&C
3#%&-3)'..
0#%&C///'...
!"7 7 F" '
'>')'"D"'3'"D"'0
*
*
3.2 Write an application that reads the (x, y) coordinates for two points.
Compute the distance between the two points using the following formula:
Distance =
%)>
%%>!!>
=
#$!
!"?7%!G$F"
%#%&
%>#%&
!#%&
!>#%&
=#<7H<7$%>D%>'<7$!>D!>
!"=#"'=
*
*
3.3 Write an application that displays a frame containing two labels that display
your name, one for your first name and one for your last. Experiment with the
size of the window to see the labels change their orientation to each other.
$1
%$1
%))
8IG#$8I"<!"
G=G5;8IJK&L;ML5E;J
((+
8?!#$8?
!@25!
!?GN$=>0.B0
8E#$8E"婉月"
8E>#$8E"孙"
!
!>
G5?!
G2
GO
*
*
3.4 Modify the LabelDemo program so that it displays a fourth label, with the
text of the label centered above the image.
$1
%$1
%)3
8IG#$8I"E="
G=G5;8IJK&L;ML5E;J
&&#$&&"E;E"
8E>)3
#$8E"赏"$55JMJA
>#$8E"金"$55JMJA
>,N%?$5EJI
>O%?$5@;;<
)#$8E"猎"$55JMJA
),N%?$55JMJA
剩余15页未读,继续阅读
资源评论
oligaga
- 粉丝: 52
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功