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
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions 2주차 클론.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/untitled" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
3 changes: 0 additions & 3 deletions src/studentenglishname/report1/Report1_1

This file was deleted.

3 changes: 0 additions & 3 deletions src/studentenglishname/report1/Report1_2

This file was deleted.

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

This file was deleted.

6 changes: 6 additions & 0 deletions src/wooramhong/report1/Report1_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
2-4번 문제

정답 :byte b = 256; //byte는 -128~127까지임으로 (byte)256이여야함
char c = ''; //공백문자의 부재
char answer = 'no'; // char는 영단어 하나만
float f = 3.14 //함수는 뒤에 f가 붙어야함
9 changes: 9 additions & 0 deletions src/wooramhong/report1/Report1_2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
2-7번 번 문제

정답 : System.out.println("1" + "2"); // 12
System.out.println(true + ""); //true
System.out.println('A' + 'B'); //131
System.out.println('1' + 2); //51
System.out.println('1' + '2'); //99
System.out.println('J' + "ava"); //Java
System.out.println(true + null); //오류
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
package studentenglishname.report1;
package wooramhong.report1;
// 2-8 번 문제 <- 이렇게 문제 번호 작성 필수
public class Report1_3 {
public static void main(String[] args) {
// 정답 작성
int x = 1;
int y = 2;
int z = 3;
int temp=0;

temp=x;
x=y;
y=z;
z=temp;

// Ex)
AddClass addClass = new AddClass();
addClass.test();
Expand Down
5 changes: 5 additions & 0 deletions src/wooramhong/report2/Report2_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
3-1번문제

정답 :1. b=(byte)i
2. float f = (float)l;
3. i = (int)ch
22 changes: 22 additions & 0 deletions src/wooramhong/report2/Report2_2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package wooramhong.report2;
// 3-2번 문제
public class Report2_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); //True y>=5가 성립하기 때문에
System.out.println(y += 10 - x++); //13 x++은 뒤에 적용되기 때문에
System.out.println(x += 2); //5 x = x+2와 같은 의미기 때문에
System.out.println(!('A' <= c && c <= 'Z')); //false &&으로 두가지가 모두 성립하지 않으면 false
System.out.println('C' - c); //2 C의 문자코드가 67
System.out.println('5' - '0'); //5 int형으로 변환
System.out.println(c + 1); //66 c='A'이고 A의 문자코드는 65 고로 65+1
System.out.println(++c); //B c='A'이고 A의 문자코드는 65 거기에 +1을 해 66인 상태로 다시 char로 변환하면 B
System.out.println(c++); //B 위에서 B가 되었고, 늦게 더해짐으로
System.out.println(c); //C 위에서 늦게나마 +1이 되어서

}
}

3 changes: 3 additions & 0 deletions src/wooramhong/report2/Report2_3
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3-3번 문제

정답: (num/100)*100
11 changes: 11 additions & 0 deletions src/wooramhong/report2/Report2_4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package wooramhong.report2;
//3-4번문제
public class Report2_4 {
public static void main(String[] args) {
int numOfApples = 123; // 사과의 개수
int sizeOfBucket = 10; // 바구니의 크기(바구니에 담을 수 있는 사과의 개수)
int numOfBucket = numOfApples % sizeOfBucket > 0 ? numOfApples/sizeOfBucket+1 : numOfApples%sizeOfBucket ;// 모든 사과를 담는데 필요한 바구니의 수

System.out.println("필요한 바구니의 수 :"+numOfBucket);
}
}
3 changes: 3 additions & 0 deletions src/wooramhong/report2/Report2_5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3-5번 문제

정답:num == 0 ? 0 : num>0? "양수입니다.":"음수입니다"
11 changes: 11 additions & 0 deletions src/wooramhong/report2/Report2_6.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package wooramhong.report2;

public class Report2_6 {
public static void main(String[] args) {
int fahrenheit = 100;
double celcius = Math.floor(((float)5/9 *(fahrenheit-32))*100) > ((float)5/9 *(fahrenheit-32))*100 -0.5? Math.floor(((float)5/9 *(fahrenheit-32))*100)/100 : Math.floor(((float)5/9 *(fahrenheit-32))*100)/100+0.01;

System.out.println("Fahrenheit:"+fahrenheit);
System.out.println("Celcius:"+celcius);
}
}
61 changes: 61 additions & 0 deletions src/wooramhong/report3/Report3_1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package wooramhong.report3;

import java.util.Scanner;

class Report3_1 {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int x=scanner.nextInt();
if (x>10&&20>x) {
System.out.println(true);
}
}
public static void main2(String[] args) {
char ch= 'A';
if (ch != ' ' || ch !='\t') {
System.out.println(true);
}
}

public static void main3(String[] args) {
char ch= 'A';
if (ch == 'x' || ch == 'X') {
System.out.println(true);
}
}

public static void main4(String[] args) {
char ch= 'A';
if (ch >= '0' && ch <= '9') {
System.out.println(true);
}
}

public static void main5(String[] args) {
char ch= 'A';
if (ch >= 'a' && ch <='z' || ch >= 'A' && ch<='Z') {
System.out.println(true);
}
}

public static void main6(String[] args) {
int year=5;
if (year % 4== 0 || year % 100 != 0) {
System.out.println(true);
}
}

public static void main7(String[] args) {
boolean powerOn = false;
if (powerOn = false) {
System.out.println(true);
}
}

public static void main8(String[] args) {
String str = "yes";
if (str == "yes") {
System.out.println(true);
}
}
}
30 changes: 30 additions & 0 deletions src/wooramhong/report3/Report3_10.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package wooramhong.report3;

public class Report3_10 {
public static void main(String[] args) {
// 1~100사이의 임의의 값을 얻어서 answer에 저장한다.
int answer = (int)(Math.random()*101);
int input = 0; //사용자입력을 저장할 공간
int count = 0; //시도횟수를 세기위한 변수

// 화면으로 부터 사용자입력을 받기 위해서 Scanner클래스 사용
java.util.Scanner s = new java.util.Scanner(System.in);
do {
count++;
System.out.print("1과 100사이의 값을 입력하세요 : ");
input = s.nextInt(); //입력받은 값을 변수 input에 저장한다.
if (input == answer) {
System.out.println("정답입니다."+count+"번째에 맞추셨습니다.");
break;
} else if (input>100) {
System.out.println("100 이하의 숫자를 입력하세요");
} else if (input<0) {
System.out.println("1 이상의 숫자를 입력하세요");
}else if (input<answer) {
System.out.println("더 높은 숫자입니다.");
}else if (input>answer) {
System.out.println("더 낮은 숫자입니다.");
}
} while(true); //무한반복문
} // end of main
}
11 changes: 11 additions & 0 deletions src/wooramhong/report3/Report3_2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package wooramhong.report3;

class Report3_2 {
public static void main(String[] args) {
int sum = 0;
for (int i = 0; i < 21; i++) {
sum+=i;
}
System.out.println("sum="+sum);
}
}
15 changes: 15 additions & 0 deletions src/wooramhong/report3/Report3_3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package wooramhong.report3;

class Report3_3 {
public static void main(String[] args) {
int sum = 0;
int totalSum = 0;
for (int i = 0; i < 11; i++) {
for (int j = 0; j < i; j++) {
sum+=j;
}
totalSum+=sum;
}
System.out.println("totalSum="+totalSum);
}
}
21 changes: 21 additions & 0 deletions src/wooramhong/report3/Report3_4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package wooramhong.report3;

class Report3_4 {
public static void main(String[] args) {
int sum = 0; // 총합을 저장할 변수
int s = 1; // 값의 부호를 바꿔주는데 사용할 변수
int num = 0;
while(sum<100){
if (s % 2==0) {
sum-=s;
}
else {
sum+=s;
}
s++;
}
num=s;
System.out.println("num="+num);
System.out.println("sum="+sum);
}
}
22 changes: 22 additions & 0 deletions src/wooramhong/report3/Report3_5.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package wooramhong.report3;

class Report3_5 {
public static void main(String[] args) {
// for (int i = 0; i <= 10; i++) {
// for (int j = 0; j <= i; j++)
// System.out.print("*");
// System.out.println();
// }
int i=0;
int j=0;
while(i<=10){
i++;
j=0;
while(j<=i){
j++;
System.out.print("*");
}
System.out.println();
}
}
}
17 changes: 17 additions & 0 deletions src/wooramhong/report3/Report3_6.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package wooramhong.report3;

class Report3_6 {
public static void main(String[] args) {
int[] dice1={1,2,3,4,5,6};
int[] dice2={1,2,3,4,5,6};

for (int i = 0; i < dice1.length; i++) {
for (int j = 0; j < dice2.length; j++) {
int sum=dice1[i]+dice2[j];
if (sum==6) {
System.out.println("첫번쨰 주사위"+dice1[i]+"와 두번째 주사위"+dice2[j]);
}
}
}
}
}
15 changes: 15 additions & 0 deletions src/wooramhong/report3/Report3_7.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package wooramhong.report3;

class Report3_7 {
public static void main(String[] args) {
String str = "12345";
int sum = 0;

for (int i = 0; i < str.length(); i++) {
char[] chArr = str.toCharArray();
sum+=(int)chArr[i]-48;
}

System.out.println("sum=" + sum);
}
}
8 changes: 8 additions & 0 deletions src/wooramhong/report3/Report3_8.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package wooramhong.report3;

public class Report3_8 {
public static void main(String[] args){
int value = (int)(Math.random()*6+1);
System.out.println("value:"+value);
}
}
13 changes: 13 additions & 0 deletions src/wooramhong/report3/Report3_9.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package wooramhong.report3;

class Report3_9 {
public static void main(String[] args) {
int num = 12345;
int sum = 0;
while(num>0){
sum += num%10;
num/=10;
}
System.out.println("sum="+sum);
}
}
1 change: 1 addition & 0 deletions src/wooramhong/report3/로그인flow.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2023-01-19T12:38:05.413Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36" version="20.8.5" etag="SIk2K52n_nyHnzyiSWxA" type="device"><diagram id="uZogvPbcA8hyV7G29uqW" name="페이지-1">1Zhbb5swFMc/jR9bYczFfgSabZo0aVMm7dkNbkAiISLk0n76Hd+4hrZpm6XrS83Bxz6cc35/ExBJVsevFd9kP8pUFMh10iMid8iFvwDDP2l51JaQBdqwrPJUm3BrmOdPwhgdY93lqdj2JtZlWdT5pm9clOu1WNQ9G6+q8tCf9lAW/V03fClGhvmCF2PrnzytM22lbtjav4l8mdmdccD0nRW3k82TbDOeloeOicwQSaqyrPVodUxEIZNn86L9vkzcbQKrxLp+jQP57u8O96vi19Oc70Mc7n57qxtXr7Lnxc48sAm2frQZEOs0komEq0XBt9t8gUic1asCDBiGVblbp0Ju4sCVdhfpKKttmLaMvFqK+pnYSJMk6C5RrkRdPYLfoS2Db1KbdSpgbZUoeJ3v+2Fw0w3LZrlmh59lDgG6julcn9362sc0LnP6S2zLXbUQxqub9pcWwuFgJZ2I0Uow6Dx3a1JlPaPEZFziWYRiF1EHzRIUBYjdyQGNEUvkgM0Qw6M2OGR5LeYbvpDXB4C93wV8u9H4PeRH2QymEfaiqsXx+VYYl9g6jFJHTOo6PUBP9AB1psvdS++5ufRO5DKR+Ys9NItRxBDzrAV2CAoIKL6vYLSUIzknZoiqybGjKhCrUlA0u0OMopie8lI1ob7awkGRPypOy6CsxQulek9lTCFO1AG7JwoRXKoQ/ifWreC6utUjpjlHz5et/jpDpC4sWsFJ0CIsqZHqhRVxgAwQ51viptiZwJNEsINajaDYN0jCyo2LqwQS1tfAgkBKTtV8wBDueopf4FHCrsYUy3Ezx5BLzZr0rZoAob4jTmpVXYcboCixPjo1IP5Ehj4tK85lZcU43OB+0/mvlBk87PIP05nwE+sMvarO0MHZTPy3Ks1wJY/8W62hr9KaLmwAUSiB0rBFVlzau1i9SoFvKOlt5alhW4kXjZRYaGnQvlrRlBEsEnJt8T4Bm8MyOdd+CWDXgvNa0DXpbV7DPFuUc6lrXgyml7owdjaA57kzyATqSFPc0cROw+3PFjONGbKmIOqRaE89SSJR8y255izXaHe3iGRszO2cnrT9DXVtQl2nX1I39K8MKMYvE7rN+EYOHwpxNKjG51FrHw9j7Wo+IoW3Af0PmHbDYdXctzI9lIcg/DCk4bL9UqWnt9/7yOwv</diagram></mxfile>
Loading