diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/.idea/.gitignore b/src/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/src/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/src/.idea/misc.xml b/src/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/src/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/.idea/modules.xml b/src/.idea/modules.xml new file mode 100644 index 0000000..0b0b192 --- /dev/null +++ b/src/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/.idea/vcs.xml b/src/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/src/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/hanghae-java-study-12.iml b/src/hanghae-java-study-12.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/src/hanghae-java-study-12.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report1/.gitignore b/src/parkseongmin/report1/.gitignore new file mode 100644 index 0000000..916dd3d --- /dev/null +++ b/src/parkseongmin/report1/.gitignore @@ -0,0 +1,2 @@ +.idea +.iml \ No newline at end of file diff --git a/src/parkseongmin/report1/Report1_1 b/src/parkseongmin/report1/Report1_1 new file mode 100644 index 0000000..5980acb --- /dev/null +++ b/src/parkseongmin/report1/Report1_1 @@ -0,0 +1,3 @@ +2-4번 문제 + +정답 :1,2,3,4 diff --git a/src/parkseongmin/report1/Report1_2 b/src/parkseongmin/report1/Report1_2 new file mode 100644 index 0000000..a385b05 --- /dev/null +++ b/src/parkseongmin/report1/Report1_2 @@ -0,0 +1,10 @@ +2-7번 번 문제 + +정답 : +System.out.println("1" + "2"); 12 +System.out.println(true+""); true +System.out.println('A' + 'B'); AB +System.out.println('1' + 2); 오류 숫자와 문자열 결합 불가 +System.out.println('1' + '2'); 12 +System.out.println('J' +"ava"); 오류 '' ""통일 필요 +System.out.println(true + null); true \ No newline at end of file diff --git a/src/parkseongmin/report1/Report1_3.java b/src/parkseongmin/report1/Report1_3.java new file mode 100644 index 0000000..0a6904e --- /dev/null +++ b/src/parkseongmin/report1/Report1_3.java @@ -0,0 +1,17 @@ +package parkseongmin.report1; +// 2-8 번 문제 <- 이렇게 문제 번호 작성 필수 +public class Report1_3 { + public static void main(String[] args){ + int x = 1; + int y = 2; + int z = 3; + + x = x+1; + y += 1; + z %= 2; + + System.out.println("x="+x); + System.out.println("y="+y); + System.out.println("z="+z); + } +} \ No newline at end of file diff --git a/src/parkseongmin/report1/report1.iml b/src/parkseongmin/report1/report1.iml new file mode 100644 index 0000000..c3e7338 --- /dev/null +++ b/src/parkseongmin/report1/report1.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report2/.gitignore b/src/parkseongmin/report2/.gitignore new file mode 100644 index 0000000..c0e638b --- /dev/null +++ b/src/parkseongmin/report2/.gitignore @@ -0,0 +1,2 @@ +.iml +.idea diff --git a/src/parkseongmin/report2/Report2_1 b/src/parkseongmin/report2/Report2_1 new file mode 100644 index 0000000..abe68ea --- /dev/null +++ b/src/parkseongmin/report2/Report2_1 @@ -0,0 +1,3 @@ +2-4번 문제 + +정답 :1,3 diff --git a/src/parkseongmin/report2/Report2_2.java b/src/parkseongmin/report2/Report2_2.java new file mode 100644 index 0000000..3e1737d --- /dev/null +++ b/src/parkseongmin/report2/Report2_2.java @@ -0,0 +1,20 @@ +package parkseongmin.report2; +// 3-2번 문제 +public class Report2_2 { + public static void main(String[] args){ + int x = 2; + int y = 5; + char c = 'A'; // 'A'의 문자코드는 65 + + System.out.println(y >= 5 || x < 0 && x > 2); // true // y >= 5 true, x < 0 False, x >2 False 이므로0 true, False 중 하나가 참이므로 + System.out.println(y += 10 - x++); // 13 // y = 5+10로 y = 15이고 x는 2이므로 15-2이다. ++ 후위 증가 연산자로 x의 값은 이후 3이고 y값은 13이다. + System.out.println(x += 2); // 5 // x는 현재 3이고 +2를 더 한 값을 대입하면 5이다. + System.out.println(!('A' <= c && c <= 'Z')); // False // 'A'와 'Z'는 문자열이므로 오류 + System.out.println('C' - c); // 2 // 'A'는 65, 'C'는 67이므로 2 + System.out.println('5' - '0'); // 5 // 모두 문자열이므로 값을 변환해준다. '5'는 53 '0'은 48이므로 + System.out.println(c + 1); // 66 // 숫자 1과 결합하기 위해 자동으로 int(A) 적용되어 'A'는 65, 65 + 1 = 66 + System.out.println(++c); // B // 'A'는 65, 1을 먼저 증가 = 66 는 문자열 B + System.out.println(c++); // B // 현재 c의 값은 문자열 B를 출력하고 이후 c의 값은 문자열 C가 된다. + System.out.println(c); // C // 현재 문자열 값인 C를 출력 + } +} diff --git a/src/parkseongmin/report2/Report2_3.java b/src/parkseongmin/report2/Report2_3.java new file mode 100644 index 0000000..f88876b --- /dev/null +++ b/src/parkseongmin/report2/Report2_3.java @@ -0,0 +1,8 @@ +package parkseongmin.report2; +// 3-3번 문제 +public class Report2_3 { + public static void main(String[] args){ + int num = 456; + System.out.println((int)Math.floor(num/100) *100); + } +} diff --git a/src/parkseongmin/report2/Report2_4.java b/src/parkseongmin/report2/Report2_4.java new file mode 100644 index 0000000..4b463ba --- /dev/null +++ b/src/parkseongmin/report2/Report2_4.java @@ -0,0 +1,11 @@ +package parkseongmin.report2; +// 3-4번 문제 +public class Report2_4 { + public static void main(String[] args){ + int numOfApples = 123; // 사과의 개수 + int sizeOfBucket = 10; // 바구니의 크기(바구니에 담을 수 있는 사과의 개수) + int numOfBucket = (int)Math.ceil(numOfApples/(float)sizeOfBucket); // 모든 사과를 담는데 필요한 바구니의 수 + // 앞에 unmOfBucket이 int값으로 정의되어 있으므로 float 변환 후 다시 int로 변환해준다 + System.out.println("필요한 바구니의 수 :"+numOfBucket); + } +} diff --git a/src/parkseongmin/report2/Report2_5.java b/src/parkseongmin/report2/Report2_5.java new file mode 100644 index 0000000..1e5c875 --- /dev/null +++ b/src/parkseongmin/report2/Report2_5.java @@ -0,0 +1,8 @@ +package parkseongmin.report2; +// 3-5번 문제 +public class Report2_5 { + public static void main(String[] args){ + int num = 10; + System.out.println( num > 0 ? "양수" : num < 0 ? "음수" : 0 ); + } +} diff --git a/src/parkseongmin/report2/Report2_6.java b/src/parkseongmin/report2/Report2_6.java new file mode 100644 index 0000000..830c254 --- /dev/null +++ b/src/parkseongmin/report2/Report2_6.java @@ -0,0 +1,12 @@ +package parkseongmin.report2; +// 3-6번 문제 +public class Report2_6 { + public static void main(String[] args){ + int fahrenheit = 100; + float celcius = ((float) 5/9*(fahrenheit-32)*100 - (float) Math.floor((double) 5/9*(fahrenheit-32)*100) < 0.5 ? (float) Math.floor((double) 5/9*(fahrenheit-32)*100)/100: + (float) 5/9*(fahrenheit-32)*100 - (float) Math.floor((double) 5/9*(fahrenheit-32)*100) >= 0.5 ? (float) Math.ceil((double) 5/9*(fahrenheit-32)*100)/100 : 0); + // 삼항 연산자에서 조건을 2개 넣으려면 :를 꼭 3개 이상 사용해야하는지 궁금합니다. + System.out.println("Fahrenheit:"+fahrenheit); + System.out.println("Celcius:"+celcius); + } +} diff --git a/src/parkseongmin/report3/.gitinore b/src/parkseongmin/report3/.gitinore new file mode 100644 index 0000000..916dd3d --- /dev/null +++ b/src/parkseongmin/report3/.gitinore @@ -0,0 +1,2 @@ +.idea +.iml \ No newline at end of file diff --git a/src/parkseongmin/report3/.idea/vcs.xml b/src/parkseongmin/report3/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/src/parkseongmin/report3/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report3/.idea/workspace.xml b/src/parkseongmin/report3/.idea/workspace.xml new file mode 100644 index 0000000..eb61cc3 --- /dev/null +++ b/src/parkseongmin/report3/.idea/workspace.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1674107859226 + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report3/Report3_1 b/src/parkseongmin/report3/Report3_1 new file mode 100644 index 0000000..0ded8a5 --- /dev/null +++ b/src/parkseongmin/report3/Report3_1 @@ -0,0 +1,13 @@ +4-1번 문제 + +정답 : + int x; ( 10 < x && x < 20 ) + char ch; ( ch == ' ' || ch == '\t' || ch=='\n') + char ch; ( ch == 'x' || ch == 'X') + char ch; ('0' <= ch && ch <= '9') + char ch; ('A' <= ch && ch <= 'Z' || 'a' <= ch && ch <= 'z') + int year; (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) + boolean powerOn; powerOn = false; System.out.println(true) + + str.equals("yes") + str.equalsIgnoreCase("yes") \ No newline at end of file diff --git a/src/parkseongmin/report3/Report3_2.java b/src/parkseongmin/report3/Report3_2.java new file mode 100644 index 0000000..dddd7e8 --- /dev/null +++ b/src/parkseongmin/report3/Report3_2.java @@ -0,0 +1,25 @@ +// 4-2번 문제 +class Exercise4_2_1 { + public static void main(String[] args) { + int sum = 0; + for (int i = 1; i <= 20; i++) { + if (i % 2 != 0 && i % 3 != 0){ + sum += i; + } + } + System.out.println("sum=" + sum); + } +} + +// 다른 정답 +class Exercise4_2_2 { + public static void main(String[] args) { + int sum = 0; + for (int i = 1; i <= 20; i++) { + if (i % 2 == 0 || i % 3 == 0){ + continue; + } sum += i; + } + System.out.println("sum=" + sum); + } +} \ No newline at end of file diff --git a/src/parkseongmin/report3/Report3_3.java b/src/parkseongmin/report3/Report3_3.java new file mode 100644 index 0000000..d515c28 --- /dev/null +++ b/src/parkseongmin/report3/Report3_3.java @@ -0,0 +1,12 @@ +// 4-3번 문제 +class Exercise4_3 { + public static void main(String[] args) { + int sum = 0; + int totalSum = 0; + for (int i = 1; i <= 10; i ++){ + sum += i; + totalSum += sum; + } + System.out.println("totalSum="+totalSum); + } +} \ No newline at end of file diff --git a/src/parkseongmin/report3/Report3_4.java b/src/parkseongmin/report3/Report3_4.java new file mode 100644 index 0000000..eadd48e --- /dev/null +++ b/src/parkseongmin/report3/Report3_4.java @@ -0,0 +1,14 @@ +// 4-4번 문제 +class Exercise4_4 { + public static void main(String[] args) { + int sum = 0; // 총합을 저장할 변수 + int s = 1; // 값의 부호를 바꿔주는데 사용할 변수 + int num = 0; + for (int i = 1; sum < 100; i++, s = -s){ + num = s*i; + sum += num; + } + System.out.println("num="+num); + System.out.println("sum="+sum); + } +} \ No newline at end of file diff --git a/src/parkseongmin/report3/Report3_5.java b/src/parkseongmin/report3/Report3_5.java new file mode 100644 index 0000000..4ddfc3a --- /dev/null +++ b/src/parkseongmin/report3/Report3_5.java @@ -0,0 +1,13 @@ +// 4-5번 문제 +class Exercise4_5 { + public static void main(String[] args) { + int i = 0; + while(i <= 10){ + for (int j = 0; j <= i; j++) { + System.out.print("*"); + } + System.out.println(); + i++; + } + }//end of main +} // end of class \ No newline at end of file diff --git a/src/parkseongmin/report3/Report3_6.java b/src/parkseongmin/report3/Report3_6.java new file mode 100644 index 0000000..3c1374d --- /dev/null +++ b/src/parkseongmin/report3/Report3_6.java @@ -0,0 +1,16 @@ +// 4-6번 문제 +class Exercise4_6 { + public static void main(String[] args) { + int [] num = {1,2,3,4,5,6}; + for (int i = 0; i < num.length;) { + for (int k : num) { + if (num[i] + k != 6) { + continue; + } + System.out.print(num[i] + ","); + System.out.println(k); + } + i++; + } + } +} \ No newline at end of file diff --git a/src/parkseongmin/report3/Report3_7.java b/src/parkseongmin/report3/Report3_7.java new file mode 100644 index 0000000..617abfa --- /dev/null +++ b/src/parkseongmin/report3/Report3_7.java @@ -0,0 +1,14 @@ +// 4-7번 문제 +class Exercise4_7 { + public static void main(String[] args) { + String str = "12345"; + int sum = 0; + int num = Integer.parseInt(str); + + for (int i = 0; i < str.length(); i++) { + sum += num % 10; + num /= 10; + } + System.out.println("sum=" + sum); + } +} \ No newline at end of file diff --git a/src/parkseongmin/report3/Report3_8.java b/src/parkseongmin/report3/Report3_8.java new file mode 100644 index 0000000..482a37d --- /dev/null +++ b/src/parkseongmin/report3/Report3_8.java @@ -0,0 +1,13 @@ +// 4-8번 문제 +class Exercise4_9 { + public static void main(String[] args) { + int num = 12345; + int sum = 0; + while(num > 0){ + sum += num%10; + num /= 10; + } + + System.out.println("sum="+sum); + } +} diff --git a/src/parkseongmin/report3/Report3_9.java b/src/parkseongmin/report3/Report3_9.java new file mode 100644 index 0000000..b26c79a --- /dev/null +++ b/src/parkseongmin/report3/Report3_9.java @@ -0,0 +1,24 @@ +// 4-7번 문제 +class Exercise4_10 { + public static void main(String[] args) { + int answer = (int)(Math.random()*100); + int input = 0; + int count = 0; + + java.util.Scanner s = new java.util.Scanner(System.in); + do { + count++; + System.out.print("1과 100사이의 값을 입력하세요 : "); + input = s.nextInt(); + if (input < answer){ + System.out.println("더 큰 수를 입력하세요. : "); + } else if (input > answer){ + System.out.println("더 작은 수를 입력하세요. : "); + } else { + System.out.println("맞혔습니다."); + System.out.println("시도횟수는 " + count + "번 입니다."); + break; + } + } while(true); + } +} \ No newline at end of file diff --git a/src/parkseongmin/report3/Untitled.drawio.png b/src/parkseongmin/report3/Untitled.drawio.png new file mode 100644 index 0000000..3964d6f Binary files /dev/null and b/src/parkseongmin/report3/Untitled.drawio.png differ diff --git a/src/parkseongmin/report3/flowchart.jfif b/src/parkseongmin/report3/flowchart.jfif new file mode 100644 index 0000000..ccba8ac Binary files /dev/null and b/src/parkseongmin/report3/flowchart.jfif differ diff --git a/src/parkseongmin/report4/.gitinore b/src/parkseongmin/report4/.gitinore new file mode 100644 index 0000000..916dd3d --- /dev/null +++ b/src/parkseongmin/report4/.gitinore @@ -0,0 +1,2 @@ +.idea +.iml \ No newline at end of file diff --git a/src/parkseongmin/report4/.idea/misc.xml b/src/parkseongmin/report4/.idea/misc.xml new file mode 100644 index 0000000..e0844bc --- /dev/null +++ b/src/parkseongmin/report4/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report4/.idea/modules.xml b/src/parkseongmin/report4/.idea/modules.xml new file mode 100644 index 0000000..2e1ee1e --- /dev/null +++ b/src/parkseongmin/report4/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report4/.idea/report4.iml b/src/parkseongmin/report4/.idea/report4.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/src/parkseongmin/report4/.idea/report4.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report4/.idea/vcs.xml b/src/parkseongmin/report4/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/src/parkseongmin/report4/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report4/.idea/workspace.xml b/src/parkseongmin/report4/.idea/workspace.xml new file mode 100644 index 0000000..38308b6 --- /dev/null +++ b/src/parkseongmin/report4/.idea/workspace.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1674382866301 + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report4/Report4_1 b/src/parkseongmin/report4/Report4_1 new file mode 100644 index 0000000..7cf1074 --- /dev/null +++ b/src/parkseongmin/report4/Report4_1 @@ -0,0 +1,4 @@ +5-1번 문제 + +정답 :1 명확한 값 배정이 되어있지 않다. + 2 , 뒤 공백이다. \ No newline at end of file diff --git a/src/parkseongmin/report4/Report4_2 b/src/parkseongmin/report4/Report4_2 new file mode 100644 index 0000000..7e45a36 --- /dev/null +++ b/src/parkseongmin/report4/Report4_2 @@ -0,0 +1,3 @@ +5-2번 문제 + +정답 :4 \ No newline at end of file diff --git a/src/parkseongmin/report4/Report4_3.java b/src/parkseongmin/report4/Report4_3.java new file mode 100644 index 0000000..288e714 --- /dev/null +++ b/src/parkseongmin/report4/Report4_3.java @@ -0,0 +1,11 @@ +// 5-3번 문제 +class Exercise5_3{ + public static void main(String[] args){ + int[] arr = {10, 20, 30, 40, 50}; + int sum = 0; + for (int i = 0; i + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report5/.idea/modules.xml b/src/parkseongmin/report5/.idea/modules.xml new file mode 100644 index 0000000..30a3d3b --- /dev/null +++ b/src/parkseongmin/report5/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report5/.idea/vcs.xml b/src/parkseongmin/report5/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/src/parkseongmin/report5/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report5/.iml b/src/parkseongmin/report5/.iml new file mode 100644 index 0000000..31b0141 --- /dev/null +++ b/src/parkseongmin/report5/.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report5/Report5_1.java b/src/parkseongmin/report5/Report5_1.java new file mode 100644 index 0000000..a236e4d --- /dev/null +++ b/src/parkseongmin/report5/Report5_1.java @@ -0,0 +1,41 @@ +package parkseongmin.report5; +// 6-1,2,3 번 문제 +class Student { + String name; + int ban, no, kor, eng, math; + + public Student(String name, int ban, int no, int kor, int eng, int math) { + this.name = name; + this.ban = ban; + this.no = no; + this.kor = kor; + this.eng = eng; + this.math = math; + } + + public int getTotal() { + int total = kor + eng + math; + return total; + } + + public float getAverage() { + float avg = (kor+eng+math)/3f; + avg = ((int)(avg*10+0.5))/10f; + return avg; + } + + public String info() { + Stirng[] str = new String[8]; + str[0] = name; + str[1] = Integer.toString(ban); + str[2] = Integer.toString(no); + str[3] = Integer.toString(kor); + str[4] = Integer.toString(eng); + str[5] = Integer.toString(math); + str[6] = Integer.toString(getTotal()); + str[7] = Float.toString(getAverage()); + return Arrays.toString(str); + } +} + + diff --git a/src/parkseongmin/report5/Report5_2 b/src/parkseongmin/report5/Report5_2 new file mode 100644 index 0000000..8ba0e21 --- /dev/null +++ b/src/parkseongmin/report5/Report5_2 @@ -0,0 +1,9 @@ +6-5번 문제 + +정답 : +클래스 변수 + width,height +인스턴스 변수 + kind, num +지역 변수 + 1, 1 \ No newline at end of file diff --git a/src/parkseongmin/report5/Report5_2.java b/src/parkseongmin/report5/Report5_2.java new file mode 100644 index 0000000..e69de29 diff --git a/src/parkseongmin/report5/Report5_3 b/src/parkseongmin/report5/Report5_3 new file mode 100644 index 0000000..ce12cde --- /dev/null +++ b/src/parkseongmin/report5/Report5_3 @@ -0,0 +1,4 @@ +6-7번 문제 + +정답: +weapon, armor 모든 병사의 공격력과 방어력이 같아야 하므로 \ No newline at end of file diff --git a/src/parkseongmin/report6/.gitinore b/src/parkseongmin/report6/.gitinore new file mode 100644 index 0000000..916dd3d --- /dev/null +++ b/src/parkseongmin/report6/.gitinore @@ -0,0 +1,2 @@ +.idea +.iml \ No newline at end of file diff --git a/src/parkseongmin/report6/.idea/.gitignore b/src/parkseongmin/report6/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/src/parkseongmin/report6/.idea/misc.xml b/src/parkseongmin/report6/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/src/parkseongmin/report6/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report6/.idea/modules.xml b/src/parkseongmin/report6/.idea/modules.xml new file mode 100644 index 0000000..53f9791 --- /dev/null +++ b/src/parkseongmin/report6/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report6/.idea/report6.iml b/src/parkseongmin/report6/.idea/report6.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/src/parkseongmin/report6/.idea/report6.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report6/.idea/vcs.xml b/src/parkseongmin/report6/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/src/parkseongmin/report6/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report6/.idea/workspace.xml b/src/parkseongmin/report6/.idea/workspace.xml new file mode 100644 index 0000000..dba6775 --- /dev/null +++ b/src/parkseongmin/report6/.idea/workspace.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1674382913783 + + + + + + \ No newline at end of file diff --git a/src/parkseongmin/report6/Report6_1 b/src/parkseongmin/report6/Report6_1 new file mode 100644 index 0000000..472b5c6 --- /dev/null +++ b/src/parkseongmin/report6/Report6_1 @@ -0,0 +1 @@ +// 6-8번 문제 \ No newline at end of file diff --git a/src/parkseongmin/report7/Report7_1.java b/src/parkseongmin/report7/Report7_1.java new file mode 100644 index 0000000..f764a60 --- /dev/null +++ b/src/parkseongmin/report7/Report7_1.java @@ -0,0 +1,11 @@ +package parkseongmin.report7; +// 6-17번 문제 +public class Report7_1 { + public static void main(String[] args) { + int[] original = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + System.out.println(java.util.Arrays.toString(original)); + +// int[] result = shuffle(original); +// System.out.println(java.util.Arrays.toString(result)); + } +} diff --git a/src/parkseongmin/report8/Report8_1.java b/src/parkseongmin/report8/Report8_1.java new file mode 100644 index 0000000..bd9d03c --- /dev/null +++ b/src/parkseongmin/report8/Report8_1.java @@ -0,0 +1,18 @@ +package parkseongmin.report8; +// 7-1번 문제 +public class Report8_1 { + public static void main(String args[]) { +// SutdaDeck deck = new SutdaDeck(); +// for(int i=0; i < deck.cards.length;i++) System.out.print(deck.cards[i]+","); + } +} + +class SutdaDeck { +// ... +} + +class SutdaCard { +// ... +} + + diff --git a/src/parkseongmin/solid/step1/Calculator.java b/src/parkseongmin/solid/step1/Calculator.java new file mode 100644 index 0000000..0eeceae --- /dev/null +++ b/src/parkseongmin/solid/step1/Calculator.java @@ -0,0 +1,19 @@ +package parkseongmin.solid.step1; + +public class Calculator { + public int calculate(String operator, int firstNumber, int secondNumber) { + int answer = 0; + + if(operator.equals("+")){ + answer = firstNumber + secondNumber; + }else if(operator.equals("-")){ + answer = firstNumber - secondNumber; + }else if(operator.equals("*")){ + answer = firstNumber * secondNumber; + }else if(operator.equals("/")){ + answer = firstNumber / secondNumber; + } + + return answer; + } +} diff --git a/src/parkseongmin/solid/step2/Calculator.java b/src/parkseongmin/solid/step2/Calculator.java new file mode 100644 index 0000000..bd4d121 --- /dev/null +++ b/src/parkseongmin/solid/step2/Calculator.java @@ -0,0 +1,19 @@ +package parkseongmin.solid.step2; + +public class Calculator { + public int calculate(String operator, int firstNumber, int secondNumber) { + int answer = 0; + + if(operator.equals("+")){ + answer = firstNumber + secondNumber; + }else if(operator.equals("-")){ + answer = firstNumber - secondNumber; + }else if(operator.equals("*")){ + answer = firstNumber * secondNumber; + }else if(operator.equals("/")){ + answer = firstNumber / secondNumber; + } + + return answer; + } +} diff --git a/src/parkseongmin/solid/step3/Calculator.java b/src/parkseongmin/solid/step3/Calculator.java new file mode 100644 index 0000000..0e14351 --- /dev/null +++ b/src/parkseongmin/solid/step3/Calculator.java @@ -0,0 +1,19 @@ +package parkseongmin.solid.step3; + +public class Calculator { + public int calculate(String operator, int firstNumber, int secondNumber) { + int answer = 0; + + if(operator.equals("+")){ + answer = firstNumber + secondNumber; + }else if(operator.equals("-")){ + answer = firstNumber - secondNumber; + }else if(operator.equals("*")){ + answer = firstNumber * secondNumber; + }else if(operator.equals("/")){ + answer = firstNumber / secondNumber; + } + + return answer; + } +} diff --git a/src/parkseongmin/solid/step4/Calculator.java b/src/parkseongmin/solid/step4/Calculator.java new file mode 100644 index 0000000..68c5de9 --- /dev/null +++ b/src/parkseongmin/solid/step4/Calculator.java @@ -0,0 +1,19 @@ +package parkseongmin.solid.step4; + +public class Calculator { + public int calculate(String operator, int firstNumber, int secondNumber) { + int answer = 0; + + if(operator.equals("+")){ + answer = firstNumber + secondNumber; + }else if(operator.equals("-")){ + answer = firstNumber - secondNumber; + }else if(operator.equals("*")){ + answer = firstNumber * secondNumber; + }else if(operator.equals("/")){ + answer = firstNumber / secondNumber; + } + + return answer; + } +} diff --git a/src/parkseongmin/solid/step5/Calculator.java b/src/parkseongmin/solid/step5/Calculator.java new file mode 100644 index 0000000..ac35d24 --- /dev/null +++ b/src/parkseongmin/solid/step5/Calculator.java @@ -0,0 +1,19 @@ +package parkseongmin.solid.step5; + +public class Calculator { + public int calculate(String operator, int firstNumber, int secondNumber) { + int answer = 0; + + if(operator.equals("+")){ + answer = firstNumber + secondNumber; + }else if(operator.equals("-")){ + answer = firstNumber - secondNumber; + }else if(operator.equals("*")){ + answer = firstNumber * secondNumber; + }else if(operator.equals("/")){ + answer = firstNumber / secondNumber; + } + + return answer; + } +}