java 圆类 testcircle_CircleTest

CircleTest

所属分类:Java编程

开发工具:Java

文件大小:1KB

下载次数:0

上传日期:2020-06-19 23:22:54

上 传 者:SuCan127

说明:  设计一个圆Circle类,包含圆心和半径两个数据成员。

(1)编写合理的构造方法。

(2)编写计算圆面积的方法getArea

(3)编写计算圆是否包含指定点的方法contains(Point), contains(int x, int y)。

设计Point类,包括构造函数和计算点之间距离的方法(考虑重载形式);

设计Circle类中构造函数、计算面积的 getArea()方法、判断点是否在圆中的方法contains(Point p)和contains(int x, int y)两种重载形式;

设计测试类CircleTest中,根据用户的输入构造相应的点和圆,并输出圆的面积(保留2位小数)和点是否在圆中。

(Design a circle class, which contains two data members: Center and radius.

(1) Write a reasonable construction method.

(2) Write the method getarea to calculate the circle area

(3) Write the method contains (point), contains (int x, int y) to calculate whether a circle contains a specified point.

According to the requirements of exercises, design the point class, including the method of calculating the distance between constructors and points (considering the form of overload);

Two overloaded forms are designed: the constructor in circle class, the getarea () method of calculating area, the methods of containing (point P) and containing (int x, int y) to judge whether a point is in a circle;

In the design test class circletest, the corresponding points and circles are constructed according to the user's input, and the area of the circle (2 decimal places are reserved) and whether the points are in the circle are output.)

文件列表:[举报垃圾]

CircleTest.java, 2508 , 2020-04-26

PointClient.java, 2025 , 2020-04-11

近期下载者:

相关文件:

收藏者:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值