1. 程式人生 > >Java語言程式設計(基礎篇)第十版 綜合題 **3.23(幾何: 點是否在矩形內?)

Java語言程式設計(基礎篇)第十版 綜合題 **3.23(幾何: 點是否在矩形內?)


public class J3_24 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        java.util.Scanner input = new java.util.Scanner(System.in);

        System.out.print("Enter a ponit with two coordinates");
        double x = input.nextDouble();
        double y = input.nextDouble();

        if
(x <= 5 && y <=2.5) System.out.println("Point ("+x+","+y+") is in the rectangle"); else System.out.println("Point ("+x+","+y+") isn't in the rectangle"); } }