From ad5de7a43842f84e193208841a29b7b725067b51 Mon Sep 17 00:00:00 2001 From: Kang seungyeon <77188916+KangSYeon@users.noreply.github.com> Date: Tue, 6 Sep 2022 14:22:19 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[1=EC=A3=BC=EC=B0=A8]=20=EC=98=88=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 변수와 연산자 예제 --- CircleCalc.java | 18 ++++++++++++++++++ FirstProgram.java | 20 ++++++++++++++++++++ Hello.java | 10 ++++++++++ 3 files changed, 48 insertions(+) create mode 100644 CircleCalc.java create mode 100644 FirstProgram.java create mode 100644 Hello.java diff --git a/CircleCalc.java b/CircleCalc.java new file mode 100644 index 0000000..d93e68f --- /dev/null +++ b/CircleCalc.java @@ -0,0 +1,18 @@ +import java.util.Scanner; + +public class CircleCalc { + + public static void main(String[] args) { + final double PI = 3.14159; + double radius; + double area; + + Scanner keyboard = new Scanner(System.in); + System.out.println("반지름 : "); + radius = keyboard.nextDouble(); + area = PI * radius * radius; + System.out.println("원의 넓이 : " + area); + + } + +} diff --git a/FirstProgram.java b/FirstProgram.java new file mode 100644 index 0000000..081cdff --- /dev/null +++ b/FirstProgram.java @@ -0,0 +1,20 @@ +import java.util.Scanner; + +public class FirstProgram { + + public static void main(String[] args) { + System.out.println("Enter two whole numbers on a line:"); + int n1, n2; + + Scanner keyboard = new Scanner(System.in); + + n1 = keyboard.nextInt(); + + n2 = keyboard.nextInt(); + + System.out.println("The sum of those two number is"); + System.out.println(n1 + n2); + + } + +} diff --git a/Hello.java b/Hello.java new file mode 100644 index 0000000..d01cf13 --- /dev/null +++ b/Hello.java @@ -0,0 +1,10 @@ + +public class Hello { + + public static void main(String[] args) { + // TODO Auto-generated method stub + System.out.println("Hello, everyone!!"); + + } + +} From 67d8c5407856380207c2b5f70e013e2af56d982b Mon Sep 17 00:00:00 2001 From: Kang seungyeon <77188916+KangSYeon@users.noreply.github.com> Date: Tue, 6 Sep 2022 15:20:19 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[1=EC=A3=BC=EC=B0=A8]=20=EA=B3=BC=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1주차 변수와 연산자 과제 --- ...\352\260\225\354\212\271\354\227\260.java" | 40 +++++++++++++++++++ ...\352\260\225\354\212\271\354\227\260.java" | 37 +++++++++++++++++ ...\352\260\225\354\212\271\354\227\260.java" | 35 ++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 "[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_1_\352\260\225\354\212\271\354\227\260.java" create mode 100644 "[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_2_\352\260\225\354\212\271\354\227\260.java" create mode 100644 "[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_3_\352\260\225\354\212\271\354\227\260.java" diff --git "a/[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_1_\352\260\225\354\212\271\354\227\260.java" "b/[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_1_\352\260\225\354\212\271\354\227\260.java" new file mode 100644 index 0000000..b65bfeb --- /dev/null +++ "b/[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_1_\352\260\225\354\212\271\354\227\260.java" @@ -0,0 +1,40 @@ +import java.util.Scanner; +public class Week1_1_강승연 { + + public static void main(String[] args) { + + System.out.println("============"); + System.out.println("전공: 사이버보안"); + System.out.println("학번: 2171056"); + System.out.println("성명: 강승연"); + System.out.println("============"); + + //Scanner Class 선언 + Scanner input = new Scanner(System.in); + + //변수 선언 및 초기화 + int base = 0; + int height = 0; + float area = 0; + + System.out.print("Input base:"); + + //base 입력 + base = input.nextInt(); + + System.out.print("Input height:"); + + //height 입력 + height = input.nextInt(); + + //area 계산 + 형변환 + area = (float)(base * height) / 2; + + System.out.println("The area :" + area); + + //Scanner close + input.close(); + + } + +} diff --git "a/[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_2_\352\260\225\354\212\271\354\227\260.java" "b/[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_2_\352\260\225\354\212\271\354\227\260.java" new file mode 100644 index 0000000..17ba694 --- /dev/null +++ "b/[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_2_\352\260\225\354\212\271\354\227\260.java" @@ -0,0 +1,37 @@ +import java.util.Scanner; +public class Week1_2_강승연 { + + public static void main(String[] args) { + + System.out.println("============"); + System.out.println("전공: 사이버보안"); + System.out.println("학번: 2171056"); + System.out.println("성명: 강승연"); + System.out.println("============"); + + //Scanner Class 선언 + Scanner input = new Scanner(System.in); + + //변수 선언 및 초기화 + int int1 = 0; + int int2 = 0; + int int3 = 0; + float avg = 0.0f; + + System.out.println("정수 세 개 입력"); + + //int1,2,3 입력 + int1 = input.nextInt(); + int2 = input.nextInt(); + int3 = input.nextInt(); + + //avg 계산 + 형변환 + avg = (float)(int1 + int2 + int3) / 3; + + System.out.printf("평균:" + "%.2f", avg); + + //Scanner close + input.close(); + } + +} diff --git "a/[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_3_\352\260\225\354\212\271\354\227\260.java" "b/[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_3_\352\260\225\354\212\271\354\227\260.java" new file mode 100644 index 0000000..8842033 --- /dev/null +++ "b/[1\354\243\274\354\260\250] \352\263\274\354\240\234/Week1_3_\352\260\225\354\212\271\354\227\260.java" @@ -0,0 +1,35 @@ +import java.util.Scanner; +public class Week1_3_강승연 { + + public static void main(String[] args) { + + System.out.println("============"); + System.out.println("전공: 사이버보안"); + System.out.println("학번: 2171056"); + System.out.println("성명: 강승연"); + System.out.println("============"); + + //Scanner Class 선언 + Scanner input = new Scanner(System.in); + + //변수 선언 및 초기화 + int temF = 0; + float temC = 0.0f; + + //화씨온도 입력 + System.out.print("화씨온도 입력:"); + temF = input.nextInt(); + + System.out.println("화씨온도:" + temF); + + //섭씨온도 계산 + 형변환 + temC = (float)5/9 * (temF - 32); + + System.out.printf("섭씨온도:" + "%.1f", temC); + + //Scanner close + input.close(); + + } + +}