云南大学软件学院
实验 告
姓名:王增伟学 :20111120083班级:软件工程日期:2014.10.21成绩:
JAVA实验五
一、实验目的:
Applying OO Concepts Using Java
二、实验要求:
Create a class called Circle.java with fields named radius,area, and diameter.Include methods named setRadius(),getRadius,and computeDiameter(),which calculates the circle’s diameter,and computeArea(),which computes the circle’s area.
Hint:diameter of a circle is twice its radius.
Hint:area of a circle is3.14multiplied by the square of the radius.
Create a class called TestCircle.java whose main method declares 2Circle http://www.doczj.com/doc/c2bbc38503d276a20029bd64783e0912a2167cdd.htmling setRadius()method,assign one Circle a small radius value and assign another a larger radius value.Call
computeDiameter()and computeArea for each circle and display the results.
Output result of using command input”58″:
The area of a is78.5
The diameter of a is10.0
The area of b is200.96
The diameter of b is16.0
文章知识点与官方知识档案匹配,可进一步学习相关知识Java技能树首页概览91286 人正在系统学习中 相关资源:倒计时软件.exe_倒计时电脑软件-管理软件工具类资源-CSDN文库
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!