-
Notifications
You must be signed in to change notification settings - Fork 51
오영석report 제출 #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
youngseokaa
wants to merge
1
commit into
beatitudo331:main
Choose a base branch
from
youngseokaa:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
오영석report 제출 #62
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| //2-4. 다음 중 변수를 잘못 초기화 한 것은? 1 2 3 4 | ||
| byte b = 256; | ||
| char c = ''; | ||
| char answer = 'no'; | ||
| float f = 3.14 | ||
| double d = 1.4e3f; | ||
|
|
||
| //2-7. 다음 문장들의 출력 결과를 적으세요. 오류가 있는 문장의 경우, '오류' 라고 적으세요. | ||
| System.out.println("1" + "2"); | ||
| System.out.println(true+""); 오류 | ||
| System.out.println('A' + 'B'); | ||
| System.out.println('1' + 2); 오류 | ||
| System.out.println('1' + '2'); | ||
| System.out.println('J' +"ava"); 오류 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 문자열 결합 파트 부분 다시한번 봐주세요! |
||
| System.out.println(true + null); 오류 | ||
|
|
||
| /2-8. 아래는 변수 x, y, z의 값을 서로 바꾸는 예제이다. 결과와 같이 출력되도록 코드를 넣으세요. | ||
| public class Exercise2_8{ | ||
| public static void main(String[] args){ | ||
| int x = 1; | ||
| int y = 2; | ||
| int z = 3; | ||
| tem; = x; | ||
| x= y; | ||
| y= z; | ||
| z= tem; | ||
| System.out.println("x="+x); | ||
| System.out.println("y="+y); | ||
| System.out.println("z="+z); | ||
| } | ||
| } | ||
| //예상 결과 : x=2, y=3, z=1ㄹㄹ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| byte b = 10; | ||
| char ch = 'A'; | ||
| int i = 100; | ||
| long l = 1000L; | ||
| //3-1. 다음 중 형변환을 생략할 수 있는 것은? (모두 고르시오) 4,5 | ||
| b = (byte)i; | ||
| ch = (char)b; | ||
| short s = (short)ch; | ||
| float f = (float)l; | ||
| i = (int)ch; | ||
|
|
||
|
|
||
|
|
||
| //3-2. 다음 연산의 결과와 그 이유를 적으세요. | ||
| class Exercise3_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); ture | ||
| System.out.println(y += 10 - x++); 13 | ||
| System.out.println(x += 2); 5 | ||
| System.out.println(!('A' <= c && c <= 'Z'));false | ||
| System.out.println('C' - c); 2 | ||
| System.out.println('5' - '0'); | ||
| System.out.println(c + 1); 66 | ||
| System.out.println(++c); 66 | ||
| System.out.println(c++); 65 | ||
| System.out.println(c); 66 | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| //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); | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| //3-4. 아래의 코드는 사과를 담는데 필요한 바구니(버켓)의 수를 구하는 코드이다. | ||
| //만일 사과의 수가 123개이고 하나의 바구니에는 10개의 사과를 담을 수 있다면, 13개의 바구니가 필요할 것이다. | ||
| //알맞은 코드를 넣으시오. | ||
| class Exercise3_4{ | ||
| public static void main(String[] args){ | ||
| int numOfApples = 123; // 사과의 개수 | ||
| int sizeOfBucket = 10; // 바구니의 크기(바구니에 담을 수 있는 사과의 개수) | ||
| int numOfBucket = (/*빈 칸*/); // 모든 사과를 담는데 필요한 바구니의 수 | ||
|
|
||
| System.out.println("필요한 바구니의 수 :"+((Math.ceil((double)numOfApples/numOfBucket))*10); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. numOfBucket 값 없음을 확인해 주세요! |
||
| } | ||
| } | ||
| //예상 결과 -> 필요한 바구니의 수 :13 | ||
|
|
||
|
|
||
|
|
||
| //3-5. 아래는 변수 num의 값에 따라 '양수', '음수', '0'을 출력하는 코드이다. | ||
| //삼항연산자를 이용해서 빈칸에 알맞은 코드를 넣으시오. | ||
| //Hint : 삼항 연산자를 두 번 사용할 것! | ||
| class Exercise3_5{ | ||
| public static void main(String[] args){ | ||
| int num = 10; | ||
|
|
||
| System.out.println(/*빈 칸*/); | ||
| } | ||
| } | ||
| //예상 결과 : 양수 | ||
|
|
||
|
|
||
|
|
||
| //3-6. 아래는 화씨(Fahrenheit)를 섭씨(Celcius)로 변환하는 코드이다. | ||
| //변환 공식이 'C = 5/9*(F-32)'라고 할 때, 빈 칸에 알맞은 코드를 넣으시오. | ||
| // 단, 변환값은 소수점 셋째자리에서 반올림하며, Math.round() 함수를 사용하지 않고 처리할 것! | ||
| class Exercise3_6{ | ||
| public static void main(String[] args){ | ||
| scanf("%d",&celcius); | ||
| int fahrenheit = 100; | ||
| int input, tenTousand, thousand, hubdred: | ||
| float celcius = (5/9*(fahrenheit -32))) | ||
| celcius = (tenThousend* 10000) +(thousand* 1000) + ((hundred >=5) * 5000) ; | ||
| System.out.println("Fahrenheit:"+fahrenheit); | ||
| System.out.println("Celcius:"+celcius); | ||
| } | ||
| } | ||
| //예상 결과 : Fahrenheit:100, Celcius:37.78 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
산술변환 과 형변환 파트 다시 학습하시면 좋을 것 같습니다!