Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
2-4번 문제

정답 :
1
10 changes: 10 additions & 0 deletions src/kimyuyoung/report1/Report1_2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
2-7번 번 문제

정답 :
12
true
AB
51
12
Java
오류
22 changes: 22 additions & 0 deletions src/kimyuyoung/report1/Report1_3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package kimyuyoung.report1;
// 2-8 번 문제 <- 이렇게 문제 번호 작성 필수

public class Report1_3 {
public static void main(String[] args) {
int x = 1;
int y = 2;
int z = 3;
int tmp;

tmp = x;
x = z;
z = tmp;

System.out.println("x=" + x);
System.out.println("y=" + y);
System.out.println("z=" + z);
System.out.println("tmp=" + tmp);

}
}

2 changes: 2 additions & 0 deletions src/kimyuyoung/report2/Report2_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
float f = (float)l;
i = (int)ch;
11 changes: 11 additions & 0 deletions src/kimyuyoung/report2/Report2_2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
6
true
13
5
false
2
5
66
B
B
C
14 changes: 14 additions & 0 deletions src/kimyuyoung/report2/Report2_3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package kimyuyoung.report2;

public class Report2_3 {

//3-3. 아래는 변수의 num 값 중에서 백의 자리 이하를 버리는 코드이다.
//만일 변수 num의 값이 '456'이라면 '400'이 되고, '111'이라면 '100'이 된다.
//알맞은 코드를 넣으시오.
class Exercise3_3 {
public static void main(String[] args){
int num = 456;
System.out.println(num/100*100);
}
}
}
18 changes: 18 additions & 0 deletions src/kimyuyoung/report2/Report2_4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package kimyuyoung.report2;

public class Report2_4 {

//3-4. 아래의 코드는 사과를 담는데 필요한 바구니(버켓)의 수를 구하는 코드이다.
//만일 사과의 수가 123개이고 하나의 바구니에는 10개의 사과를 담을 수 있다면, 13개의 바구니가 필요할 것이다.
//알맞은 코드를 넣으시오.
class Exercise3_4{
public static void main(String[] args){
int numOfApples = 123; // 사과의 개수
int sizeOfBucket = 10; // 바구니의 크기(바구니에 담을 수 있는 사과의 개수)
int numOfBucket = (numOfApples/sizeOfBucket+(numOfApples%sizeOfBucket>0?1:0)); // 모든 사과를 담는데 필요한 바구니의 수

System.out.println("필요한 바구니의 수 :"+numOfBucket);
}
}
//예상 결과 -> 필요한 바구니의 수 :13
}
15 changes: 15 additions & 0 deletions src/kimyuyoung/report2/Report2_5.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package kimyuyoung.report2;

public class Report2_5 {

//3-5. 아래는 변수 num의 값에 따라 '양수', '음수', '0'을 출력하는 코드이다.
//삼항연산자를 이용해서 빈칸에 알맞은 코드를 넣으시오.
//Hint : 삼항 연산자를 두 번 사용할 것!
class Exercise3_5{
public static void main(String[] args){
int num = 10;
System.out.println(num<0?"음수":"0");
}
}
//예상 결과 : 양수
}
17 changes: 17 additions & 0 deletions src/kimyuyoung/report2/Report2_6.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package kimyuyoung.report2;

public class Report2_6 {
//3-6. 아래는 화씨(Fahrenheit)를 섭씨(Celcius)로 변환하는 코드이다.
//변환 공식이 'C = 5/9*(F-32)'라고 할 때, 빈 칸에 알맞은 코드를 넣으시오.
// 단, 변환값은 소수점 셋째자리에서 반올림하며, Math.round() 함수를 사용하지 않고 처리할 것!
class Exercise3_6{
public static void main(String[] args){
int fahrenheit = 100;
float celcius = (int)((5/9f*(fahrenheit-32)*100+0.5)/100f);

System.out.println("Fahrenheit:"+fahrenheit);
System.out.println("Celcius:"+celcius);
}
}
//예상 결과 : Fahrenheit:100, Celcius:37.78
}
3 changes: 0 additions & 3 deletions src/studentenglishname/report1/Report1_2

This file was deleted.

17 changes: 0 additions & 17 deletions src/studentenglishname/report1/Report1_3.java

This file was deleted.

7 changes: 0 additions & 7 deletions src/studentenglishname/report2/Report2_2.java

This file was deleted.