From 32553f779541c23a62735603fa9435dd57d4129f Mon Sep 17 00:00:00 2001 From: pr882260 Date: Thu, 27 Feb 2025 04:14:02 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=85=EB=B6=80=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EB=AC=B8=EC=A0=9C=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 0 -> 10244 bytes .classpath | 6 + .project | 23 ++++ .settings/.jsdtscope | 7 ++ ...rg.eclipse.wst.jsdt.ui.superType.container | 1 + .../org.eclipse.wst.jsdt.ui.superType.name | 1 + answer/.DS_Store | Bin 0 -> 6148 bytes java_test/.DS_Store | Bin 0 -> 6148 bytes java_test/.gitignore | 12 ++ java_test/a.java | 9 +- java_test/b.java | 16 ++- java_test/c.java | 14 ++- java_test/d.java | 15 ++- java_test/e.java | 18 ++- java_test/f.java | 20 +++- java_test/g1.java | 57 ++++++++-- java_test/g2.java | 106 ++++++++++++++++-- 17 files changed, 255 insertions(+), 50 deletions(-) create mode 100644 .DS_Store create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/.jsdtscope create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.container create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.name create mode 100644 answer/.DS_Store create mode 100644 java_test/.DS_Store create mode 100644 java_test/.gitignore diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c1efd8f2b654e7505c2d0454c33cfd6cae06349b GIT binary patch literal 10244 zcmeHMYitx%6u#fIlv&HLQyy9v7gm->qa_ruNGXq{Ey^=Rw(TwjU3PZ{Ix?N9JF~lm zrb#tE5`09XQUCeiudk4RCTi4wC`Ka^<17C02l_*Q7>)iio;!Dz(4}ZhG_g82x%b?2 z?m2VkeD|EWxpx?2=ql-}8H+QyNH7d3x0uZey zv0tc9=K$X(9?)b!Cj|9P>6zm6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!0#D*8iuLCx+Ig(Mgjet?PT>u_iMQ}J&f-0s!w2|~qW?1<^Z2DE zruR&aY5Y2MOxJ9c(MwxpiWOLqnQVl%%>UZ9`6pi1U@{rVkP8tA5eN|o5eN~OW(d@Y z_l@)W|7} + + + + + 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 0000000000000000000000000000000000000000..572f171cfd0f4d0b111b77cc8d99e0c3634c8c86 GIT binary patch literal 6148 zcmeHKUrWO<5Kp%1Hiys$g*^s*9k@SC9KMupegP}`pfX!Jwqk9@+S!LO=(BzyKZ&2m zyCef==c^kf2bbR^mut9Ro1{kwq4vUW6JioVs-TF*5j0x_{ir!9sS$Kid*VsA7U=y!F2C|yf4#dvwUes#T`aEG)C_0__L>1a9~da2r7)8yjt*!<2>@uo zun@4ZmcSUM&{CL51P=(6p@1@!suF|Ba2RK5o~1C8D8mU=#RpX@Q&pi*u{u1TiRpw| z5_PK?&;KIl-O~(c1`5RhHHOa6hLqIZnoADvS_b+Iih}bpi6R6V ibsY->ui^%%5b!ZH04;@?L>K|lKLUaV-Dn2>m4R=+C-p1< literal 0 HcmV?d00001 diff --git a/java_test/.DS_Store b/java_test/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T00 ;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()); + } + } +} +