-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tester.java
47 lines (37 loc) · 1.15 KB
/
Tester.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* In The Name of ALLAH
*
* Written by: Mortaza Seydi - Zanjan University - Winter 2018
*
*/
public class Tester
{
public static void main (String[] args)
{
Rectangle rec1 = new Rectangle("0,0", "8,8");
if (!rec1.check())
{
System.out.println("This Points Does Not Make Rectangle");
System.exit(0);
}
Rectangle rec2 = new Rectangle("1,1", "10,6");
if(!rec2.check())
{
System.out.println("This Points Does Not Make Rectangle");
System.exit(0);
}
if (rec1.hasIntersection(rec2))
System.out.println("\nyes they have Intersection\n");
else
System.out.println("\nno they do not have Intersection\n");
Rectangle newRec = rec1.getCommonRectangle(rec2);
if (newRec != null)
newRec.draw("*");
else
System.out.println("\nError\n");
if (rec1.contains(rec2))
System.out.println("\nyes they are contains\n");
else
System.out.println("\nyes they are not contains\n");
}
}