Repository navigation
Expand file tree
/
Copy pathDraw.java
More file actions
68 lines (58 loc) · 1.58 KB
/
Copy pathDraw.java
File metadata and controls
68 lines (58 loc) · 1.58 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import java.util.ArrayList;
import java.util.List;
public class Draw {
private List<Point> list = new ArrayList<>();
public Draw(List<String> points){
for (String point : points) {
list.add(new Point(point));
}
}
public void drawline(int num){
for(int y = 24; y > 0; y--){
odd(y);
notOdd(y);
System.out.print("|");
drawX(y, num);
System.out.println();
}
}
public void drawX(int y, int num){
for(int x =0; x < 25; x++){
printPoint(x, y, num);
}
}
public boolean checkPoint(int x, int y, Point point){
if(point.xValue() == x && point.yValue() == y)
return true;
return false;
}
public void printPoint(int x, int y, int num){
for(int i = 0; i < num; i++){
printStar(x, y, i);
}
System.out.print(" ");
}
public void printStar(int x, int y, int i){
if(checkPoint(x, y, list.get(i)))
System.out.print("*");
}
public void odd(int i){
if(i % 2 == 0)
System.out.print(String.format("%2s", i));
}
public void notOdd(int i){
if (i % 2 != 0)
System.out.print(String.format("%2s"," "));
}
public void printNumber(){
System.out.print(String.format("%3s","0"));
for (int i = 1; i < 25; i++){
checkNumber(i);
}
}
public void checkNumber(int i){
if(i % 2 == 0 && i != 0){
System.out.print(String.format("%4s",i));
}
}
}