From 61a23b4660a15ddbea29686276ec1aec2a284197 Mon Sep 17 00:00:00 2001 From: yunho04 <127312373+yunho04@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:39:20 +0900 Subject: [PATCH 1/6] Add files via upload From dc23551d0822c0f8106d69a9768fb52dbf6d999b Mon Sep 17 00:00:00 2001 From: yunho04 <127312373+yunho04@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:42:03 +0900 Subject: [PATCH 2/6] Add files via upload From d1d5a65498e052dd39d435562fba47786bf27981 Mon Sep 17 00:00:00 2001 From: yunho04 <127312373+yunho04@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:45:34 +0900 Subject: [PATCH 3/6] Add files via upload From 2e26da6ff377b033dfd78548f3217d66f8353196 Mon Sep 17 00:00:00 2001 From: yunho04 <127312373+yunho04@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:57:39 +0900 Subject: [PATCH 4/6] Add files via upload From 5ba63e83c2ee614813ba1eb7d6631f2f87fa1860 Mon Sep 17 00:00:00 2001 From: yunho04 <127312373+yunho04@users.noreply.github.com> Date: Tue, 4 Apr 2023 13:03:07 +0900 Subject: [PATCH 5/6] Add files via upload From a1d019d8e4f3e1cbbbf37eddfff1c21a3aec260f Mon Sep 17 00:00:00 2001 From: yunho04 <127312373+yunho04@users.noreply.github.com> Date: Fri, 7 Apr 2023 08:49:39 +0900 Subject: [PATCH 6/6] Add files via upload --- CarGame.java | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 CarGame.java diff --git a/CarGame.java b/CarGame.java new file mode 100644 index 0000000..bf247da --- /dev/null +++ b/CarGame.java @@ -0,0 +1,35 @@ +package JavaStudy; +import java.util.*; + +public class CarGame { + int number; + String [] name; + int [] speed; + + + public void introduce(){ + + System.out.println("자동차의 개수를 입력하세요"); + Scanner sc = new Scanner(System.in); + number = sc.nextInt(); + System.out.println(number); + String [] name = new String[number]; + int [] speed = new int[number]; + + for(int i=1;i<=number;i++) { + System.out.println(i + "번째 자동차의 이름을 입력하세요"); + name[i - 1] = sc.next(); + System.out.println(i + "번째 자동차의 속도를 입력하세요"); + speed[i - 1] = sc.nextInt(); + } + System.out.println("-------------경기 참가자 소개------------------"); + for(int x=1;x<=name.length; x++) { + System.out.println("스피드는" + speed[x - 1] + "이고, 이름은 " + name[x - 1] + "입니다"); + } + } + public static void main(String[]args){ + CarGame game= new CarGame(); + game.introduce(); + } + +}