diff --git a/kangduoh/first-java-assignment/.gitignore b/kangduoh/first-java-assignment/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/kangduoh/first-java-assignment/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/kangduoh/first-java-assignment/.idea/.gitignore b/kangduoh/first-java-assignment/.idea/.gitignore new file mode 100644 index 0000000..c3f502a --- /dev/null +++ b/kangduoh/first-java-assignment/.idea/.gitignore @@ -0,0 +1,8 @@ +# 디폴트 무시된 파일 +/shelf/ +/workspace.xml +# 에디터 기반 HTTP 클라이언트 요청 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/kangduoh/first-java-assignment/.idea/misc.xml b/kangduoh/first-java-assignment/.idea/misc.xml new file mode 100644 index 0000000..a6e1098 --- /dev/null +++ b/kangduoh/first-java-assignment/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kangduoh/first-java-assignment/.idea/modules.xml b/kangduoh/first-java-assignment/.idea/modules.xml new file mode 100644 index 0000000..5a80775 --- /dev/null +++ b/kangduoh/first-java-assignment/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/kangduoh/first-java-assignment/.idea/vcs.xml b/kangduoh/first-java-assignment/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/kangduoh/first-java-assignment/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kangduoh/first-java-assignment/first-java-assignment.iml b/kangduoh/first-java-assignment/first-java-assignment.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/kangduoh/first-java-assignment/first-java-assignment.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kangduoh/first-java-assignment/src/assigns/Test1.java b/kangduoh/first-java-assignment/src/assigns/Test1.java new file mode 100644 index 0000000..e9b662b --- /dev/null +++ b/kangduoh/first-java-assignment/src/assigns/Test1.java @@ -0,0 +1,82 @@ +package assigns; + +// 다음 조건을 만족하도록 Cylinder 클래스를 작성합니다. +class Cylinder { + // 원주율 3.14를 정적 상수 PI로 선언과 동시에 초기화 + private static final double PI = 3.14; + // 정수형 원의 중심 좌표 x, y를 선언 + private int x, y; + // 실수형 원의 반지름 r을 선언 + private double r; + // 정수형 원기둥의 높이 height를 10으로 선언과 동시에 초기화 + private int height = 10; + + // 생성자1: 정수 인자 x, y 와 실수 인자 r을 전달 받아서 해당 필드 값을 초기화 + Cylinder(int x, int y, double r) { + this.x = x; + this.y = y; + this.r = r; + } + + // 생성자1: 정수 인자 x, y, height 와 실수 인자 r을 전달 받아서 해당 필드 값을 초기화 + Cylinder(int x, int y, double r, int height) { + this.x = x; + this.y = y; + this.r = r; + this.height = height; + } + + // circleArea 메서드: PI를 이용하여 원의 면적 반환 + public double circleArea() { + return PI * Math.pow(r, 2); + } + + // volume 메서드: 면적과 높이를 이용하여 부피를 반환 + public double volume() { + return this.circleArea() * height; + } + + // surfaceArea 메서드: PI를 이용하여 원기둥의 겉넓이를 반환 + public double surfaceArea() { + return 2 * PI * r * (r + height); + } + + // move 메서드: 정수 인자 dx, dy를 전달 받아서 원의 중심 좌표를 이동 + // - 예: 필드 x가 1이고 dx가 10이면 x는 11로 변경되어야 함 + // 객체 자신을 반환 + public Cylinder move(int dx, int dy) { + this.x += dx; + this.y += dy; + return this; + } + + void print() { + System.out.println("<" + x + "," + y + ":" + r + ">"); + } +} + + +// 메인메서드 수행시 이렇게 출력되도록 +//<13,15:6.0> +//113.04 +//1130.4 +//602.88 +//<17,25:10.0> +//314.0 +//1570.0 +//942.0 +public class Test1 { + public static void main(String[] args) { + Cylinder c1 = new Cylinder(3,5, 6); + c1.move(10,10).print(); + System.out.println(c1.circleArea()); + System.out.println(c1.volume()); + System.out.println(c1.surfaceArea()); + + Cylinder c2 = new Cylinder(5,8, 10, 5); + c2.move(12,17).print(); + System.out.println(c2.circleArea()); + System.out.println(c2.volume()); + System.out.println((float) c2.surfaceArea()); + } +} diff --git a/kangduoh/first-java-assignment/src/bj_10810/Main.java b/kangduoh/first-java-assignment/src/bj_10810/Main.java new file mode 100644 index 0000000..5045d3d --- /dev/null +++ b/kangduoh/first-java-assignment/src/bj_10810/Main.java @@ -0,0 +1,35 @@ +package bj_10810; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.StringTokenizer; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringBuilder sb = new StringBuilder(); + + StringTokenizer st = new StringTokenizer(br.readLine()); + int N = Integer.parseInt(st.nextToken()); + int M = Integer.parseInt(st.nextToken()); + + int[] basket = new int[N]; + + for (int l = 0; l < M; l++) { + st = new StringTokenizer(br.readLine()); + int i = Integer.parseInt(st.nextToken()); + int j = Integer.parseInt(st.nextToken()); + int k = Integer.parseInt(st.nextToken()); + + for (int idx = i - 1; idx < j; idx++) + basket[idx] = k; + } + + for (int l = 0; l < N; l++) + sb.append(basket[l]).append(' '); + + System.out.println(sb); + br.close(); + } +} diff --git "a/kangduoh/first-java-assignment/src/bj_10810/\353\260\261\354\244\20010810.png" "b/kangduoh/first-java-assignment/src/bj_10810/\353\260\261\354\244\20010810.png" new file mode 100644 index 0000000..760a9e4 Binary files /dev/null and "b/kangduoh/first-java-assignment/src/bj_10810/\353\260\261\354\244\20010810.png" differ diff --git a/kangduoh/first-java-assignment/src/bj_11021/Main.java b/kangduoh/first-java-assignment/src/bj_11021/Main.java new file mode 100644 index 0000000..e29d85f --- /dev/null +++ b/kangduoh/first-java-assignment/src/bj_11021/Main.java @@ -0,0 +1,28 @@ +package bj_11021; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.StringTokenizer; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringBuilder sb = new StringBuilder(); + + int T = Integer.parseInt(br.readLine()); + StringTokenizer st = null; + int a, b; + + for (int i = 1; i <= T; i++) { + st = new StringTokenizer(br.readLine()); + a = Integer.parseInt(st.nextToken()); + b = Integer.parseInt(st.nextToken()); + + sb.append("Case #").append(i).append(": ").append(a + b).append('\n'); + } + + System.out.println(sb); + br.close(); + } +} diff --git "a/kangduoh/first-java-assignment/src/bj_11021/\353\260\261\354\244\20011021.png" "b/kangduoh/first-java-assignment/src/bj_11021/\353\260\261\354\244\20011021.png" new file mode 100644 index 0000000..a490fc8 Binary files /dev/null and "b/kangduoh/first-java-assignment/src/bj_11021/\353\260\261\354\244\20011021.png" differ diff --git a/kangduoh/first-java-assignment/src/bj_2439/Main.java b/kangduoh/first-java-assignment/src/bj_2439/Main.java new file mode 100644 index 0000000..f8b924d --- /dev/null +++ b/kangduoh/first-java-assignment/src/bj_2439/Main.java @@ -0,0 +1,27 @@ +package bj_2439; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringBuilder sb = new StringBuilder(); + + int N = Integer.parseInt(br.readLine()); + + for (int i = 0; i < N; i++) { + for (int j = 0; j < N - i - 1; j++) + sb.append(' '); + + for (int k = 0; k <= i; k++) + sb.append('*'); + + sb.append('\n'); + } + + System.out.println(sb); + br.close(); + } +} diff --git "a/kangduoh/first-java-assignment/src/bj_2439/\353\260\261\354\244\2002439.png" "b/kangduoh/first-java-assignment/src/bj_2439/\353\260\261\354\244\2002439.png" new file mode 100644 index 0000000..0d01968 Binary files /dev/null and "b/kangduoh/first-java-assignment/src/bj_2439/\353\260\261\354\244\2002439.png" differ diff --git a/kangduoh/first-java-assignment/src/bj_2588/Main.java b/kangduoh/first-java-assignment/src/bj_2588/Main.java new file mode 100644 index 0000000..0d44269 --- /dev/null +++ b/kangduoh/first-java-assignment/src/bj_2588/Main.java @@ -0,0 +1,23 @@ +package bj_2588; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringBuilder sb = new StringBuilder(); + + int num1 = Integer.parseInt(br.readLine()); + int num2 = Integer.parseInt(br.readLine()); + + sb.append(num1 * (num2 % 10)).append('\n'); + sb.append(num1 * (num2 / 10 % 10)).append('\n'); + sb.append(num1 * (num2 / 100)).append('\n'); + sb.append(num1 * num2); + + System.out.println(sb); + br.close(); + } +} diff --git "a/kangduoh/first-java-assignment/src/bj_2588/\353\260\261\354\244\2002588.png" "b/kangduoh/first-java-assignment/src/bj_2588/\353\260\261\354\244\2002588.png" new file mode 100644 index 0000000..4a9ccc8 Binary files /dev/null and "b/kangduoh/first-java-assignment/src/bj_2588/\353\260\261\354\244\2002588.png" differ diff --git a/kangduoh/first-java-assignment/src/bj_2884/Main.java b/kangduoh/first-java-assignment/src/bj_2884/Main.java new file mode 100644 index 0000000..9a006d6 --- /dev/null +++ b/kangduoh/first-java-assignment/src/bj_2884/Main.java @@ -0,0 +1,28 @@ +package bj_2884; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.StringTokenizer; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringBuilder sb = new StringBuilder(); + + StringTokenizer st = new StringTokenizer(br.readLine()); + int h = Integer.parseInt(st.nextToken()); + int m = Integer.parseInt(st.nextToken()); + + if (m < 45) { + h = (h + 23) % 24; + m += 15; + } + else + m -= 45; + + sb.append(h).append(' ').append(m); + System.out.println(sb); + br.close(); + } +} diff --git "a/kangduoh/first-java-assignment/src/bj_2884/\353\260\261\354\244\2002884.png" "b/kangduoh/first-java-assignment/src/bj_2884/\353\260\261\354\244\2002884.png" new file mode 100644 index 0000000..a7c5457 Binary files /dev/null and "b/kangduoh/first-java-assignment/src/bj_2884/\353\260\261\354\244\2002884.png" differ diff --git a/kangduoh/first-java-assignment/src/bj_9086/Main.java b/kangduoh/first-java-assignment/src/bj_9086/Main.java new file mode 100644 index 0000000..c0eee5c --- /dev/null +++ b/kangduoh/first-java-assignment/src/bj_9086/Main.java @@ -0,0 +1,23 @@ +package bj_9086; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringBuilder sb = new StringBuilder(); + + int T = Integer.parseInt(br.readLine()); + String in; + + for (int i = 0; i < T; i++) { + in = br.readLine(); + sb.append(in.charAt(0)).append(in.charAt(in.length() - 1)).append('\n'); + } + + System.out.println(sb); + br.close(); + } +} diff --git "a/kangduoh/first-java-assignment/src/bj_9086/\353\260\261\354\244\2009086.png" "b/kangduoh/first-java-assignment/src/bj_9086/\353\260\261\354\244\2009086.png" new file mode 100644 index 0000000..bb012e1 Binary files /dev/null and "b/kangduoh/first-java-assignment/src/bj_9086/\353\260\261\354\244\2009086.png" differ