myline java线段类,2008010 编写一个线段类 MyLine 联合开发网 - pudn.com

这篇博客详细介绍了如何编写一个Java线段类MyLine,包括构造方法、Point类型的属性x和y,以及检查线段位置、计算长度、判断线段相交和点到线段距离等方法。还提供了测试程序来验证这些方法的正确性。
摘要由CSDN通过智能技术生成

2008010

所属分类:Java编程

开发工具:Java

文件大小:2KB

下载次数:25

上传日期:2009-12-24 14:03:10

上 传 者:tina

说明:  编写一个线段类 MyLine,要求如下:

主要属性有: x ,y ;类型为Point (查看API)

编写构造方法,如 MyLine(Point p1 , Point p2)

编写5个成员方法。如:

检查线段是否位于第一象限check()…

求线段的长度 length() …

判断两条直线是否相交(另一线段作为参数)。

编写一点到该线段(或延长线)的距离

其他方法。

注:编写方法时,考虑利用Point类的方法

编写测试程序

(Write a segment class MyLine, requirements are as follows: The main attributes are: x, y type Point (see API) the preparation of construction methods, such as MyLine (Point p1, Point p2) prepared by five members of the method. Such as: Check whether the line segment in the first quadrant check () ... order to segment the length of the length () ... to determine whether the two straight lines intersect (the other segment as a parameter). The preparation of 1:00 to the line segment (or extension) of the distance from other methods. Note: The preparation method, consider using the Point class approach to preparing test program)

文件列表:[举报垃圾]

Myline.class

test.class

test.java

近期下载者:

相关文件:

收藏者:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值