diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..c1efd8f Binary files /dev/null and b/.DS_Store differ diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..3f3893a --- /dev/null +++ b/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..13c4477 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + 2025-SS-welcome-test + + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..cca691f --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..49c8cd4 --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.JRE_CONTAINER \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..11006e2 --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Global \ No newline at end of file diff --git a/answer/.DS_Store b/answer/.DS_Store new file mode 100644 index 0000000..572f171 Binary files /dev/null and b/answer/.DS_Store differ diff --git a/java_test/.DS_Store b/java_test/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/java_test/.DS_Store differ diff --git a/java_test/.gitignore b/java_test/.gitignore new file mode 100644 index 0000000..0441a2a --- /dev/null +++ b/java_test/.gitignore @@ -0,0 +1,12 @@ +/Fan.class +/a.class +/b.class +/c.class +/d.class +/e.class +/f.class +/g1.class +/g2.class +/Book.class +/EBook.class +/PrintedBook.class diff --git a/java_test/a.java b/java_test/a.java index 88363b2..2929300 100644 --- a/java_test/a.java +++ b/java_test/a.java @@ -1,10 +1,11 @@ package java_test; +import java.util.*; public class a { public static void main(String[] args) { - - // 이 부분에 code를 작성해주세요! - + Scanner sc=new Scanner(System.in); + String str=sc.nextLine(); + StringBuffer sb=new StringBuffer(str); + System.out.println(sb.reverse()); } - } \ No newline at end of file diff --git a/java_test/b.java b/java_test/b.java index 4225cb2..7276874 100644 --- a/java_test/b.java +++ b/java_test/b.java @@ -1,10 +1,18 @@ package java_test; +import java.util.*; public class b { public static void main(String[] args) { - - // 이 부분에 code를 작성해주세요! - + Scanner sc=new Scanner(System.in); + String str=sc.nextLine(); + String[] arr= {"a", "e", "i", "o", "u"}; + + for(String s : arr) { + if(str.contains(s)) { + System.out.println("O"); + System.exit(0); + } + } + System.out.println("X"); } - } \ No newline at end of file diff --git a/java_test/c.java b/java_test/c.java index f9d081f..7c281aa 100644 --- a/java_test/c.java +++ b/java_test/c.java @@ -1,10 +1,16 @@ package java_test; +import java.util.*; public class c { public static void main(String[] args) { - - // 이 부분에 code를 작성해주세요! - + Scanner sc=new Scanner(System.in); + int num1=sc.nextInt(); + int num2=sc.nextInt(); + + if(num1<14 && num2<155) { + System.out.println("O"); + }else { + System.out.println("X"); + } } - } \ No newline at end of file diff --git a/java_test/d.java b/java_test/d.java index 0137ce5..a083a74 100644 --- a/java_test/d.java +++ b/java_test/d.java @@ -1,10 +1,17 @@ package java_test; +import java.util.*; public class d { public static void main(String[] args) { - - // 이 부분에 code를 작성해주세요! - + Scanner sc=new Scanner(System.in); + while(true) { + int num=sc.nextInt(); + if(num<=0) { + System.out.println("X"); + break; + } + System.out.println(num*(num+1)/2); + break; + } } - } \ No newline at end of file diff --git a/java_test/e.java b/java_test/e.java index 6daa449..38d384b 100644 --- a/java_test/e.java +++ b/java_test/e.java @@ -1,10 +1,20 @@ package java_test; +import java.util.*; public class e { public static void main(String[] args) { - - // 이 부분에 code를 작성해주세요! - + Scanner sc=new Scanner(System.in); + int num1=sc.nextInt(); + int num2=sc.nextInt(); + + if(num2==4 || num2==6 || num2==9 || num2==11) { + System.out.println("30"); + }else if(num1%4==0 && (num1%100!=0 || num1%400==0) && num2==2) { + System.out.println("29"); + }else if(num2==2) { + System.out.println("28"); + }else { + System.out.println("31"); + } } - } \ No newline at end of file diff --git a/java_test/f.java b/java_test/f.java index 1249954..baa3cbc 100644 --- a/java_test/f.java +++ b/java_test/f.java @@ -1,12 +1,20 @@ package java_test; - -// 이부분에 class 선언 해도 괜찮습니다 +import java.util.*; public class f { public static void main(String[] args) { - - // 이 부분에 code를 작성해주세요! - + Scanner sc=new Scanner(System.in); + int num=sc.nextInt(), p=1; + + for(int i=1, j=num-1; i>0 ;i+=p*2, j-=p) { + if(i>num*2) { + p*=-1; + i+=p*2; j-=p; + continue; + } + for(int k=0; k { + private String model; + private int price; + + Fan(String model, int price) { + this.model=model; + this.price=price; + } + + String getModel() { return model; } + int getPrice() { return price; } + + @Override + public int compareTo(Fan o) { + if(this.price>o.price) { + return 1; + }else if(this.price fan=new ArrayList<>(); + + for(int i=0; i<3 ;i++) { + if(i!=0) sc.nextLine(); + String model=sc.nextLine(); + int price=sc.nextInt(); + fan.add(new Fan(model, price)); + } + + Collections.sort(fan); + System.out.println(fan.get(0).getModel()); + + } +} + diff --git a/java_test/g2.java b/java_test/g2.java index 5f214d7..591805f 100644 --- a/java_test/g2.java +++ b/java_test/g2.java @@ -1,12 +1,94 @@ -package java_test; - -// 이부분에 class 선언 해도 괜찮습니다 - -public class g2 { - public static void main(String[] args) { - - // 이 부분에 code를 작성해주세요! - - } - -} \ No newline at end of file +package java_test; +import java.util.*; + +abstract class Book implements Comparable { + String title; + int price; + double rating; + + @Override + public int compareTo(Book o) { + if(this.rating>o.rating) { + return -1; + }else if(this.rating arr=new ArrayList<>(); + Scanner sc=new Scanner(System.in); + boolean isFirst=true; + for(int i=0; i<3 ;i++) { + if(!isFirst) sc.nextLine(); + String genre=sc.nextLine(); + if(!genre.equals("EBook") && !genre.equals("PrintedBook")) { + System.out.println("Invalid book type. Please enter 'EBook' or 'PrintedBook'."); + isFirst=true; + i--; + continue; + } + String title=sc.nextLine(); + try { + int price=sc.nextInt(); + double rating=sc.nextDouble(); + int extra=sc.nextInt(); + + if(genre.equals("EBook")) { + arr.add(new EBook(title, price, rating, extra)); + }else { + arr.add(new PrintedBook(title, price, rating, extra)); + } + }catch(Exception e) { + System.out.println("잘못된 입력입니다. 처음부터 다시 입력하세요."); + i--; + } + isFirst=false; + } + + Collections.sort(arr); + Book book=arr.get(0); + System.out.println("Highest rated book information:"); + System.out.println("Title: "+book.title); + System.out.println("Price: "+book.price); + System.out.println("Rating: "+book.rating); + if(book.getClass().getName().contains("Printed")) { + System.out.println("Page Count: "+book.getExtra()); + }else { + System.out.println("File Size: "+book.getExtra()); + } + } +} +