第三章第二十七题(几何:点是否在三角形内?)(Geometry: points in triangle?)

根据用户输入的点的坐标,程序判断该点是否位于平面直角三角形内部。示例运行展示了不同坐标点的结果。代码实现时注意良好的编程习惯,包括文件名、注释、变量命名和代码风格的统一。
摘要由CSDN通过智能技术生成

**3.27(几何:点是否在三角形内?)假设一个平面上有一个直角三角形。编写程序,提示用户输入一个点的x坐标和y坐标,然后判断这个点是否在该三角形内。

下面是运行示例:
Enter a point’s x- and y-coordinates: 100.5 25.5
The point is in the triangle
Enter a point’s x- and y-coordinates: 100.5 50.5
The point is not in the triangle

**3.27(Geometry: points in triangle?) Suppose a right triangle is placed in a plane. Write a program that prompts the user to enter a point with x- and y-coordinates and determines whether the point is inside the triangle.

Here are the sample runs:
Enter a point’s x- and y-coordinates: 100.5 25.5
The point is in the triangle
Enter a point’s x- and y-coordinates: 100.5 50.5
The point is not in the triangle

下面是参考答案代码:

import java.util.*;

public class PointInTriangleQuestion27 {
   
	pub
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值