Java实验的答案源程序

上传者: zlczlczlczlc | 上传时间: 2022-04-13 18:06:24 | 文件大小: 351KB | 文件类型: RAR
我学习Java时做的实验题目的一些答案,可供正在学习Java的莘莘学子们参考一下,应该有你想要的实验的答 案。部分题目如下,可看一下和你们老师布置的实验题目是否一样:编写一个程序输出如下图案。编制applet 程序,绘制一个长120、宽80的红色矩形,并在矩形内部绘制一个兰色内切椭圆。设有一批英文单词存放在一个 数组中,编制一个图形界面程序浏览单词。在界面中安排一个标签显示单词,另有“上一个”、“下一个”两 个按钮实现单词的前后翻动。编写一个鼠标位置跟踪程序,在鼠标所在位置为中心绘制一个红色十字架。编制 一个声音播放控制程序,在Applet面板上安排“播放”和“停止”两个按钮,点击“播放”将播放声音,点击 “停止”可停止播放。另外,Applet启动和离开时将自动播放和停止播放,要播放的声音文件名由Applet参数 提供。有一个南北向的桥,只能容纳一个人,现桥的两边分别有10人和12人,编制一个多线程序让这些人到达 对岸,每个人用一个线程表示,桥为共享资源。在过桥的过程中显示谁在过桥及其走向。编写一个可变颜色的 标签,用一个按钮控制颜色的改变与停止。点击按钮颜色停止变化,再点击该按钮颜色又变化。颜色的变化可 用随机数确定。编写一个图片播放程序,图片的文件名为 file01.jpg,file02.jpg,…filen.jpg, 其中n由命 令行输入,要求用多线程自动播放。1)设有一个由10个英文单词构成的字符串数组,要求: (1)统计以字母w开头的单词数; (2)统计单词中含“or”字符串的单词数; (3)统计长度为3的单词数。 创建一个程序,输出今天的年、月、日。 提示:创建一个java.util.Date类的对象代表当前的系统日期,使用对象的getYear()方法、getMonth()方法、 getDay()方法可获得对应的年月日。编写一个三角形类,能根据3个实数构造三角形对象,如果三个实数不满足 三角形的条件,则自动构造以最小值为边的等边三角形。输入任意三个数,求构造的三角形面积。1) 利用随机 函数定义10对(x,y)值,由此创建的Point类实例存入一个数组中,按与原点(0,0)的距离由小到大的顺序输 出所有的点及到原点的距离。 编写一个人与计算机对拿火柴的游戏程序。利用随机函数Math.random()产生火 柴数量(20~50), 每次最多拿3根,拿到最后一根为胜者。 要求:游戏过程要显示火柴总数,选择谁先拿;每步要显示剩余火柴数量,以及计算机拿的数量,并提示用户 输入拿多少;结束时显示谁是胜者。 【解题算法提示】 (1) 产生火柴总数(amount); (2) 决定随先拿(whoplay:1--人, 2--计算机); (3) 定义一个变量保存剩余火柴数量(remain)=amount ; (4) 当remain>0 循环 4.1 根据whoplay的值决定是计算机拿x根还是提示人拿x根;计算机拿时最好带有智能,人拿时要限制输 入数量。 4.2 修改 whoplay的值; 4.3 修改remain的值; (5) 根据whoplay的值决定胜者

文件下载

资源详情

[{"title":"( 87 个子文件 351KB ) Java实验的答案源程序","children":[{"title":"Java实验的源程序","children":[{"title":"Java实验七","children":[{"title":"提高题(2).txt <span style='color:#111;'> 1.20KB </span>","children":null,"spread":false},{"title":"基本题(1).txt <span style='color:#111;'> 623B </span>","children":null,"spread":false},{"title":"基本题(4).txt <span style='color:#111;'> 1.49KB </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 898B </span>","children":null,"spread":false},{"title":"实验七总结.txt <span style='color:#111;'> 80B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 73B </span>","children":null,"spread":false},{"title":"基本题(3).txt <span style='color:#111;'> 1.21KB </span>","children":null,"spread":false},{"title":"提高题(1).txt <span style='color:#111;'> 956B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验8","children":[{"title":"基本题(1).txt <span style='color:#111;'> 521B </span>","children":null,"spread":false},{"title":"提高题(2).txt <span style='color:#111;'> 2.71KB </span>","children":null,"spread":false},{"title":"提高题(1).txt <span style='color:#111;'> 496B </span>","children":null,"spread":false},{"title":"基本题(3).txt <span style='color:#111;'> 68B </span>","children":null,"spread":false},{"title":"提高题(3).txt <span style='color:#111;'> 1.57KB </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 795B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 105B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验13","children":[{"title":"基本题(3)和思考题.txt <span style='color:#111;'> 529B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 48B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验四","children":[{"title":"基本题(1).txt <span style='color:#111;'> 478B </span>","children":null,"spread":false},{"title":"提高题(2).txt <span style='color:#111;'> 333B </span>","children":null,"spread":false},{"title":"基本题(五).txt <span style='color:#111;'> 226B </span>","children":null,"spread":false},{"title":"提高题(4).txt <span style='color:#111;'> 1.30KB </span>","children":null,"spread":false},{"title":"基本题(3).txt <span style='color:#111;'> 225B </span>","children":null,"spread":false},{"title":"提高题(3).txt <span style='color:#111;'> 1.79KB </span>","children":null,"spread":false},{"title":"基本题(4).txt <span style='color:#111;'> 304B </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 242B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 75B </span>","children":null,"spread":false},{"title":"提高题(1).txt <span style='color:#111;'> 643B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验10","children":[{"title":"基本题(1).txt <span style='color:#111;'> 1.55KB </span>","children":null,"spread":false},{"title":"基本题(3).txt <span style='color:#111;'> 1.14KB </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 1.32KB </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 50B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验一","children":[{"title":"基本题(1).txt <span style='color:#111;'> 831B </span>","children":null,"spread":false},{"title":"提高题(2).txt <span style='color:#111;'> 292B </span>","children":null,"spread":false},{"title":"提高题(1).txt <span style='color:#111;'> 519B </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 402B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 36B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验六","children":[{"title":"提高题(2).txt <span style='color:#111;'> 754B </span>","children":null,"spread":false},{"title":"基本题(5).txt <span style='color:#111;'> 394B </span>","children":null,"spread":false},{"title":"提高题(4).txt <span style='color:#111;'> 706B </span>","children":null,"spread":false},{"title":"基本题(1).txt <span style='color:#111;'> 641B </span>","children":null,"spread":false},{"title":"提高题(3).txt <span style='color:#111;'> 1.01KB </span>","children":null,"spread":false},{"title":"基本题(4).txt <span style='color:#111;'> 904B </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 287B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 52B </span>","children":null,"spread":false},{"title":"基本题(3).txt <span style='color:#111;'> 827B </span>","children":null,"spread":false},{"title":"提高题(1).txt <span style='color:#111;'> 696B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验12","children":[{"title":"基本题(1).txt <span style='color:#111;'> 1.53KB </span>","children":null,"spread":false},{"title":"提高题(1).txt <span style='color:#111;'> 1.54KB </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 641B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 34B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验五","children":[{"title":"提高题(2).txt <span style='color:#111;'> 1.06KB </span>","children":null,"spread":false},{"title":"基本题(1).txt <span style='color:#111;'> 598B </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 343B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 44B </span>","children":null,"spread":false},{"title":"基本题(3).txt <span style='color:#111;'> 859B </span>","children":null,"spread":false},{"title":"提高题(1).txt <span style='color:#111;'> 621B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验二","children":[{"title":"基本题(1).txt <span style='color:#111;'> 240B </span>","children":null,"spread":false},{"title":"基本题(3).txt <span style='color:#111;'> 193B </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 400B </span>","children":null,"spread":false},{"title":"提高(1).txt <span style='color:#111;'> 433B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 125B </span>","children":null,"spread":false},{"title":"提高(2).txt <span style='color:#111;'> 379B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验的Word文档.rar <span style='color:#111;'> 313.04KB </span>","children":null,"spread":false},{"title":"Java实验15","children":[{"title":"3.txt <span style='color:#111;'> 70B </span>","children":null,"spread":false},{"title":"6.txt <span style='color:#111;'> 468B </span>","children":null,"spread":false},{"title":"4.txt <span style='color:#111;'> 468B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验三","children":[{"title":"基本题(1).txt <span style='color:#111;'> 800B </span>","children":null,"spread":false},{"title":"提高题(2).txt <span style='color:#111;'> 817B </span>","children":null,"spread":false},{"title":"提高题(1).txt <span style='color:#111;'> 969B </span>","children":null,"spread":false},{"title":"基本题(1)的另一种方法.txt <span style='color:#111;'> 1.06KB </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 486B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 100B </span>","children":null,"spread":false}],"spread":true},{"title":"Java实验9","children":[{"title":"基本题(4).txt <span style='color:#111;'> 782B </span>","children":null,"spread":false},{"title":"基本题(1).txt <span style='color:#111;'> 484B </span>","children":null,"spread":false},{"title":"基本题(3).txt <span style='color:#111;'> 212B </span>","children":null,"spread":false},{"title":"基本题(6).txt <span style='color:#111;'> 53B </span>","children":null,"spread":false},{"title":"基本题(5).txt <span style='color:#111;'> 42B </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 506B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 62B </span>","children":null,"spread":false}],"spread":false},{"title":"Java实验11","children":[{"title":"基本题(4).txt <span style='color:#111;'> 515B </span>","children":null,"spread":false},{"title":"基本题(1).txt <span style='color:#111;'> 654B </span>","children":null,"spread":false},{"title":"基本题(3).txt <span style='color:#111;'> 897B </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 683B </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 90B </span>","children":null,"spread":false}],"spread":false},{"title":"Java实验14","children":[{"title":"提高题(1).txt <span style='color:#111;'> 949B </span>","children":null,"spread":false},{"title":"基本题(2).txt <span style='color:#111;'> 1.28KB </span>","children":null,"spread":false},{"title":"思考题.txt <span style='color:#111;'> 49B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":true}]

评论信息

  • weixin_45016100 :
    问一下诶,为什么找不到描述的第一道题啊,就是矩形这个
    2020-05-13
  • nishixinag :
    答案齐全,很好
    2012-11-20

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明