teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

2019/04/15 02:22

投稿

GK.1225
GK.1225

スコア22

title CHANGED
File without changes
body CHANGED
@@ -19,79 +19,81 @@
19
19
  import java.io.*;
20
20
  class RectangleEditor
21
21
  {
22
- public static void main(String[] args) throws IOException
22
+  public static void main(String[] args) throws IOException
23
- {
23
+ {
24
- BufferedReader br =
24
+  BufferedReader br =
25
+ new BufferedReader(new
25
- new BufferedReader(new InputStreamReader(System.in));
26
+  InputStreamReader(System.in));
26
- System.out.println("操作を選んでください");
27
+  System.out.println("操作を選んでください");
27
- System.out.println("1.create 4.delete 7.displayboard 0.exit");
28
+ System.out.println("1.create 4.delete 7.displayboard 0.exit");
28
- String str = br.readLine();
29
+ String str = br.readLine();
29
30
  //入力された文字列をstrに記録する。
30
31
  //char res = str.charAt(0);
31
32
  //入力した文字列から文字を取り出す。
32
- int num = Integer.parseInt(str);
33
+ int num = Integer.parseInt(str);
33
34
  //文字列を変換してint型の変数にする
34
- switch(num)
35
+ switch(num)
35
- {
36
+ {
36
- case 1:
37
+ case 1:
37
- System.out.println("createが入力されました");
38
+ System.out.println("createが入力されました");
38
- Command c = new Command();
39
+ Command c = new Command();
39
- c.setCommand();
40
+ c.setCommand();
40
- break;
41
+ break;
41
- case 4:
42
+ case 4:
42
- System.out.println("deleteが入力されました");
43
+ System.out.println("deleteが入力されました");
43
- break;
44
+ break;
44
- case 7:
45
+ case 7:
45
- System.out.println("displayboardが入力されました");
46
+ System.out.println("displayboardが入力されました");
46
- break;
47
+ break;
47
- case 0:
48
+ case 0:
48
- System.out.println("exitが入力されました");
49
+ System.out.println("exitが入力されました");
49
- break;
50
+ break;
51
+ }
52
+ }
50
53
  }
51
- }
52
- }
53
54
 
54
55
  --------------------------------------------------------------------------------
55
56
  import java.io.*;
56
57
  class Rectangle
57
58
  {
58
- private int haba;
59
+ private int haba;
59
- private int takasa;
60
+ private int takasa;
60
- private int x;
61
+ private int x;
61
- private int y;
62
+ private int y;
62
- int h;
63
+ int h;
63
- public void setRecatngle(int ha)
64
+ public void setRecatngle(int ha)
64
- {
65
+ {
65
- haba=0;
66
+ haba=0;
66
- takasa=0;
67
+ takasa=0;
67
- x=0;
68
+ x=0;
68
- y=0;
69
+ y=0;
69
- System.out.println("長方形を作成しました");
70
+ System.out.println("長方形を作成しました");
70
- haba=h;
71
+ haba=h;
71
- System.out.println
72
+ System.out.println
72
73
  ("幅が"+haba+"に変更されました");
74
+ }
73
75
  }
74
- }
75
76
 
76
77
  ------------------------------------------------------------------
77
78
  import java.io.*;
78
79
  class Command
79
80
  {
80
- public void setCommand()throws IOException
81
+ public void setCommand()throws IOException
81
82
  {
82
- System.out.println("ボードの要素(幅)を入力してください");
83
+ System.out.println("ボードの要素(幅)を入力してください");
83
- BufferedReader br =
84
+ BufferedReader br =
85
+ new BufferedReader(new
84
- new BufferedReader(new InputStreamReader(System.in));
86
+ InputStreamReader(System.in));
85
- String str = br.readLine();
87
+ String str = br.readLine();
86
88
  //入力された文字列をstrに記録する。
87
- int h = Integer.parseInt(str);
89
+ int h = Integer.parseInt(str);
88
- System.out.println("幅は"+h+"です");
90
+ System.out.println("幅は"+h+"です");
89
91
  //文字列を変換してint型の変数にする
90
- Rectangle r = new Rectangle();
92
+ Rectangle r = new Rectangle();
91
- r.setRectangle(h);
93
+ r.setRectangle(h);
92
94
  //haba = h;
93
95
  //takasa = t;
94
96
  //x = x1;
95
97
  //y = y1;
96
- }
98
+ }
97
99
  }

3

2019/04/15 02:22

投稿

GK.1225
GK.1225

スコア22

title CHANGED
File without changes
body CHANGED
File without changes

2

2019/04/15 02:15

投稿

GK.1225
GK.1225

スコア22

title CHANGED
File without changes
body CHANGED
@@ -14,9 +14,9 @@
14
14
 
15
15
  ---
16
16
  自分でも調べましたが、シンボルを見つけられないというエラーは様々な原因があると知り、
17
- 経験のある人に聞くべきだと考え質問に至りました。
17
+ 経験のある人に聞くべきだと考え質問に至りました。なぜエラーが出たのか、どうすればエラーが出なくなるのか教えていただきたいです
18
18
 
19
- コードimport java.io.*;
19
+ import java.io.*;
20
20
  class RectangleEditor
21
21
  {
22
22
  public static void main(String[] args) throws IOException

1

2019/04/14 19:44

投稿

GK.1225
GK.1225

スコア22

title CHANGED
File without changes
body CHANGED
File without changes