-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint33.java
More file actions
74 lines (74 loc) · 2.34 KB
/
Point33.java
File metadata and controls
74 lines (74 loc) · 2.34 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
69
70
71
72
73
74
///*
//학번 : 202301741
//이름 : 고선우
// */
//class Point {// 클래스 생성
// int x, y;// 인스턴스 변수 생성
//
// public Point(int x, int y) {// 메소드 생성
// this.x = x;// 입력받은 x 인스턴스 변수에 넣어주기
// this.y = y;// 입력받은 y 인스턴스 변수에 넣어주기
// }
//
// public int getx() {// 메소드 생성
// return x;// 리턴
// }
//
// public int gety() {// 메소드 생성
// return y;// 리턴
// }
//
// protected void move(int x, int y) {// 메소드 생성
// this.x = x;// 입력받은 x 인스턴스 변수에 넣어주기
// this.y = y;// 입력받은 y 인스턴스 변수에 넣어주기
// }
//}
//
//class Point3D extends Point {// 클래스 생성
// int z;// 인스턴스 변수 생성
//
// public Point3D(int x, int y, int z) {// 메소드 생성
// super(x, y);// 입력받은 값 상속 인스턴스 변수에 넣어주기
// this.z = z;// 입력받은 인스턴스 변수에 넣어주기
// }
//
// public int getz() {// 메소드 생성
// return z;// 반환
// }
//
// protected void moveUp() {// 메소드 생성
// z++;// +1
// }
//
// protected void moveDown() {// 메소드 생성
// z--;// -1
// }
//
// protected void move(int x, int y, int z) {// 메소드 생성
// this.x = x;// 입력받은 x 인스턴스 변수에 넣어주기
// this.y = y;// 입력받은 y 인스턴스 변수에 넣어주기
// this.z = z;// 입력받은 z 인스턴스 변수에 넣어주기
// }
//
// public String toString() {// 메소드 생성
// return "(" + x + ", " + y + ", " + z + ") 의 점";// 리턴
// }
//}
//
//public class Point33 {
// public static void main(String[] args) {
// Point3D p = new Point3D(1, 2, 3);// 객체생성
//
// System.out.println(p.toString() + "입니다.");// 출력
//
// p.moveUp();// z 축으로 위로 이동
// System.out.println(p.toString() + "입니다.");// 출력
//
// p.moveDown();// z 축으로 아래로 이동
// p.move(10, 10);// 좌표로 이동
// System.out.println(p.toString() + "입니다.");// 출력
//
// p.move(100, 200, 300);// 좌표로 이동
// System.out.println(p.toString() + "입니다.");// 출력
// }
//}