Skip to content

Commit bcc6af8

Browse files
committed
second initial commit.
0 parents  commit bcc6af8

38 files changed

+943
-0
lines changed

.classpath

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_201">
5+
<attributes>
6+
<attribute name="owner.project.facets" value="java"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v9.0">
10+
<attributes>
11+
<attribute name="owner.project.facets" value="jst.web"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
15+
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
16+
<classpathentry kind="output" path="build/classes"/>
17+
</classpath>

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build/

.project

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Webtest</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.wst.common.project.facet.core.builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.wst.validation.validationbuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
26+
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
27+
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
28+
<nature>org.eclipse.jdt.core.javanature</nature>
29+
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
30+
</natures>
31+
</projectDescription>

.settings/.jsdtscope

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="WebContent"/>
4+
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
5+
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
6+
<attributes>
7+
<attribute name="hide" value="true"/>
8+
</attributes>
9+
</classpathentry>
10+
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
11+
<classpathentry kind="output" path=""/>
12+
</classpath>

.settings/org.eclipse.jdt.core.prefs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.compliance=1.8
5+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7+
org.eclipse.jdt.core.compiler.source=1.8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
2+
<wb-module deploy-name="Webtest">
3+
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
4+
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
5+
<property name="context-root" value="Webtest"/>
6+
<property name="java-output-path" value="/Webtest/build/classes"/>
7+
</wb-module>
8+
</project-modules>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<faceted-project>
3+
<runtime name="Apache Tomcat v9.0"/>
4+
<fixed facet="jst.web"/>
5+
<fixed facet="java"/>
6+
<fixed facet="wst.jsdt.web"/>
7+
<installed facet="java" version="1.8"/>
8+
<installed facet="jst.web" version="4.0"/>
9+
<installed facet="wst.jsdt.web" version="1.0"/>
10+
</faceted-project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Window

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# testPjt
2+
this project is for practice.

WebContent/META-INF/MANIFEST.MF

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
Class-Path:
3+

WebContent/WEB-INF/web.xml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
3+
<display-name>Webtest</display-name>
4+
<welcome-file-list>
5+
<welcome-file>index.html</welcome-file>
6+
<welcome-file>index.htm</welcome-file>
7+
<welcome-file>index.jsp</welcome-file>
8+
<welcome-file>default.html</welcome-file>
9+
<welcome-file>default.htm</welcome-file>
10+
<welcome-file>default.jsp</welcome-file>
11+
</welcome-file-list>
12+
</web-app>

WebContent/test.jsp

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<%@ page language="java" contentType="text/html; charset=EUC-KR"
2+
pageEncoding="EUC-KR" import="practice.Human"%>
3+
<%
4+
String title = "Welcome to Jsp World!";
5+
System.out.println("title: " + title);
6+
7+
Human seho = new Human(177,75,"A");
8+
Human sejin = new Human();
9+
10+
seho.setWeight(seho.getWeight()+1);
11+
%>
12+
<!DOCTYPE html>
13+
<html>
14+
<head>
15+
<meta charset="EUC-KR">
16+
<title><%=title %></title>
17+
</head>
18+
<body>
19+
<p>烙技龋 个公霸: <%=seho.getWeight() %>kg</p>
20+
<p>烙技柳 个公霸: <%=sejin.getWeight() %>kg</p>
21+
</body>
22+
</html>

hello_world.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello Java World!

hello_world_copy.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
�Ӽ���!�Դϴ�.

imsejin.txt

11 Bytes
Binary file not shown.

imsejin.txt_copy.txt

20 Bytes
Binary file not shown.

src/practice/Delivery.java

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
package practice;
2+
3+
public class Delivery {
4+
/*
5+
상근이는 요즘 설탕공장에서 설탕을 배달하고 있다.
6+
상근이는 지금 사탕가게에 설탕을 정확하게 N킬로그램을 배달해야 한다.
7+
설탕공장에서 만드는 설탕은 봉지에 담겨져 있다.
8+
봉지는 3킬로그램 봉지와 5킬로그램 봉지가 있다.
9+
상근이는 귀찮기 때문에, 최대한 적은 봉지를 들고 가려고 한다.
10+
예를 들어, 18킬로그램 설탕을 배달해야 할 때,
11+
3킬로그램 봉지 6개를 가져가도 되지만,
12+
5킬로그램 3개와 3킬로그램 1개를 배달하면,
13+
더 적은 개수의 봉지를 배달할 수 있다.
14+
상근이가 설탕을 정확하게 N킬로그램 배달해야 할 때,
15+
봉지 몇 개를 가져가면 되는지 그 수를 구하는 프로그램을 작성하시오.
16+
17+
입력
18+
첫째 줄에 N이 주어진다. (3 ≤ N ≤ 5000)
19+
20+
출력
21+
상근이가 배달하는 봉지의 최소 개수를 출력한다. 만약, 정확하게 N킬로그램을 만들 수 없다면 -1을 출력한다.
22+
23+
[출처: https://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040201&docId=319719447]
24+
*/
25+
26+
public int[] calcPackageBack(int weight_sugar) {
27+
if( !(3 <= weight_sugar && weight_sugar <= 5000) ) {
28+
System.out.println("상근이가 한 번에 배달하는 설탕의 양은 3kg 이상 및 5000kg 이하입니다.");
29+
return null;
30+
}
31+
for(int i=1; ; i++) {
32+
int x = weight_sugar - 5*i; // 5kg 봉지로 담고 남은 설탕
33+
if(x < 0) {
34+
if(weight_sugar != 4 && weight_sugar != 7) i--; // 4kg와 7kg의 경우는 따로 처리한다
35+
for(; ;i--) {
36+
int y = weight_sugar - 5*i;
37+
int[] arr = new int[2];
38+
if(y == 0) {
39+
// 5kg 봉지만으로 설탕을 담을 수 있을 때
40+
arr[0] = i;
41+
arr[1] = 0;
42+
return arr;
43+
}else if(y > 0){
44+
// 3kg 봉지를 써야할 때
45+
if(y % 3 == 0) {
46+
// 3kg 봉지만으로 남은 설탕을 담을 수 있을 때
47+
arr[0] = i;
48+
arr[1] = y / 3;
49+
return arr;
50+
}else if(y % 3 > 0){
51+
// 3kg 봉지로 남은 설탕을 담을 수 있을 때까지 루프한다
52+
continue;
53+
}else {
54+
// 설탕을 완전히 담을 수 없을 때
55+
arr[0] = -1;
56+
arr[1] = -1;
57+
return arr;
58+
}
59+
}else {
60+
if(weight_sugar == 3) {
61+
// 설탕의 양이 3kg일 때
62+
arr[0] = 0;
63+
arr[1] = 1;
64+
return arr;
65+
}else {
66+
// 설탕의 양이 4kg 또는 7kg일 때
67+
arr[0] = -1;
68+
arr[1] = -1;
69+
return arr;
70+
}
71+
}
72+
}
73+
}else {
74+
continue;
75+
}
76+
}
77+
}
78+
79+
public static void main(String[] args) {
80+
Delivery deli = new Delivery();
81+
for(int i=3; i <= 1523; i++) {
82+
System.out.println("설탕 "+i+"kg");
83+
for (int val : deli.calcPackageBack(i)) {
84+
System.out.println(val+"개");
85+
}
86+
System.out.println();
87+
}
88+
}
89+
90+
}

src/practice/Human.java

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package practice;
2+
3+
public class Human {
4+
5+
private double height = 177.1;
6+
private double weight = 69.2;
7+
private String blood_type = "A";
8+
9+
public Human() {
10+
11+
}
12+
13+
public Human(double height, double weight, String blood_type) {
14+
this.height = height;
15+
this.weight = weight;
16+
this.blood_type = blood_type;
17+
}
18+
19+
20+
public double getHeight() {
21+
return this.height;
22+
}
23+
24+
public double getWeight() {
25+
return this.weight;
26+
}
27+
28+
public String getBloodType() {
29+
return this.blood_type;
30+
}
31+
32+
public void setBloodType(String blood_type) {
33+
this.blood_type = blood_type;
34+
}
35+
36+
public void setHeight(double height) {
37+
this.height = height;
38+
}
39+
40+
public void setWeight(double weight) {
41+
this.weight = weight;
42+
}
43+
44+
public static void main(String[] args) {
45+
System.out.println("height, weight, blood_type");
46+
47+
Outer o1 = new Outer();
48+
Outer.Inner i1 = o1.new Inner();
49+
Outer o2 = new Outer();
50+
// Outer.Inner i2 = new Outer.Inner();
51+
System.out.println(o2);
52+
o2.display();
53+
System.out.println(-2%3);
54+
}
55+
}
56+
57+
class Outer {
58+
int x=100;
59+
Outer.Inner inner = new Outer.Inner();
60+
61+
public void display() {
62+
Outer outer = new Outer(); // 얘를 메소드 밖으로 보내면 스택오버플로우 예외가 생긴다..?
63+
Outer.Inner inner1 = outer.new Inner();
64+
inner1.display();
65+
}
66+
67+
class Inner {
68+
int y=200;
69+
public void display() {
70+
System.out.println(this);
71+
}
72+
}
73+
}

src/practice/Matter.java

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package practice;
2+
3+
import java.util.Scanner;
4+
5+
public class Matter {
6+
public static void main(String[] args) {
7+
Scanner scan = new Scanner(System.in);
8+
while (true) {
9+
System.out.println("변수값 입력:");
10+
int n = scan.nextInt(); //
11+
int cen = (2 * n - 1) / 2; //가운데 행 위치지정
12+
int n1 = 2 * n - 1; // 마름모가 그려질 가로, 세로 길이
13+
for (int i = 0; i < n; i++) {
14+
for (int j = 0; j < cen - i + n - 1; j++) {
15+
System.out.print(" ");
16+
}
17+
for (int j = 0; j < 2 * i + 1; j++) {
18+
System.out.print("*");
19+
}
20+
System.out.println();
21+
}
22+
for (int i = 0; i < n1 / 2; i++) {
23+
for (int j = 0; j < i; j++) {
24+
System.out.print(" ");
25+
}
26+
for (int j = 0; j < (2 * n1 - 1) - 2 * i; j++) {
27+
System.out.print("*");
28+
}
29+
System.out.println();
30+
}
31+
int n2 = n - 1;
32+
for (int i = 0; i < n2; i++) {
33+
System.out.print(" ");
34+
for (int j = 0; j < n2 - 1 - i; j++) {
35+
System.out.print(" ");
36+
}
37+
for (int j = 0; j < n2 - i; j++) {
38+
System.out.print("*");
39+
}
40+
for (int j = 0; j < 1 + 4 * i; j++) {
41+
System.out.print(" ");
42+
}
43+
for (int j = 0; j < n2 - i; j++) {
44+
System.out.print("*");
45+
}
46+
for (int j = 0; j < n2 - 1 - i; j++) {
47+
System.out.print(" ");
48+
}
49+
System.out.println();
50+
}
51+
}
52+
}
53+
}

src/practice/intf/InterfaceA.java

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package practice.intf;
2+
3+
public interface InterfaceA {
4+
5+
public void functionA();
6+
}

src/practice/intf/InterfaceB.java

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package practice.intf;
2+
3+
public interface InterfaceB {
4+
5+
public void functionA();
6+
7+
public void functionB();
8+
}

0 commit comments

Comments
 (0)