java实验5云南_3云南大学软件学院JAVA实验五

云南大学软件学院

实验报告

姓名:王增伟学号: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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值