29 Aralık 2014 Pazartesi

IsPointInTheRectangle(Verilen nokta üçgenin içinde mi değil mi?)

import javax.swing.JOptionPane;

public class IsPointInTheRectangle {

public static void main(String[] args){
//Enter coordinate x
double x;
x =Double.parseDouble(JOptionPane.showInputDialog(null,"Please write the coordinate x"));
//Enter coordinate y
double y;
y = Double.parseDouble(JOptionPane.showInputDialog(null,"Please write the coordinate y"));

//Enter the conditions
if(x<5 && x>=0 && y<10 && y>=0)
{
JOptionPane.showMessageDialog(null,"Your values are in the rectangle"  );
}
else
JOptionPane.showMessageDialog(null,"Your values are not in the rectangle");

}
}

Hiç yorum yok:

Yorum Gönder