質問編集履歴
5
プログラムを全部載せました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,23 +24,153 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
|
27
|
+
public class Score {
|
28
28
|
|
29
|
-
|
29
|
+
String name;
|
30
30
|
|
31
|
-
|
31
|
+
int[] subjects = new int[5];
|
32
32
|
|
33
|
-
for(int i=0; i==subjects.length; i++) {
|
34
33
|
|
35
|
-
if (getHighScore() == subjects[i]) {
|
36
34
|
|
35
|
+
public int getJapanese(){
|
36
|
+
|
37
|
+
return subjects[0];
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
public int getMathmatics(){
|
44
|
+
|
45
|
+
return subjects[1];
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
public int getScience(){
|
52
|
+
|
53
|
+
return subjects[2];
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
public int getSocialStudies(){
|
60
|
+
|
61
|
+
return subjects[3];
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
public int getEnglish(){
|
68
|
+
|
69
|
+
return subjects[4];
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
public void setJapanese(int value){
|
76
|
+
|
77
|
+
subjects[0] = value;
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
public void setMaMathmatics(int value){
|
84
|
+
|
85
|
+
subjects[1] = value;
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
public void setScience(int value){
|
92
|
+
|
93
|
+
subjects[2] = value;
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
public void setSocialStudies(int value){
|
100
|
+
|
101
|
+
subjects[3] = value;
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
public void setEnglish(int value){
|
108
|
+
|
109
|
+
subjects[4] = value;
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
public int getHighScore(){ //最高得点を求める
|
116
|
+
|
117
|
+
int max=subjects[0];
|
118
|
+
|
119
|
+
for(int high : subjects){
|
120
|
+
|
121
|
+
if(max < high){
|
122
|
+
|
123
|
+
max = high;
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
return max;
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
String getHighScoreSubject(){ //最も点数の高い科目を表示
|
136
|
+
|
137
|
+
String[] maxsub = {"国語","数学","理科","社会","英語"};
|
138
|
+
|
139
|
+
String st = maxsub[0];
|
140
|
+
|
141
|
+
for(int j=0; j==subjects.length; j++) {
|
142
|
+
|
143
|
+
if (getHighScore() == subjects[j]) {
|
144
|
+
|
37
|
-
st = String.join(",",maxsubj
|
145
|
+
st = String.join(",",maxsub[j]);
|
38
146
|
|
39
147
|
}
|
40
148
|
|
41
149
|
}
|
42
150
|
|
43
151
|
return st;
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
void getprintInfo(){ //結果の出力
|
160
|
+
|
161
|
+
System.out.println("氏名:" + name);
|
162
|
+
|
163
|
+
System.out.println("国語:" + subjects[0] + "点");
|
164
|
+
|
165
|
+
System.out.println("数学:" + subjects[1] + "点");
|
166
|
+
|
167
|
+
System.out.println("理科:" + subjects[2] + "点");
|
168
|
+
|
169
|
+
System.out.println("社会:" + subjects[3] + "点");
|
170
|
+
|
171
|
+
System.out.println("英語:" + subjects[4] + "点");
|
172
|
+
|
173
|
+
System.out.println("最も点数が高い科目:" + getMaxSubject() + getHighScore() + "点");
|
44
174
|
|
45
175
|
}
|
46
176
|
|
@@ -58,4 +188,6 @@
|
|
58
188
|
|
59
189
|
|
60
190
|
|
61
|
-
|
191
|
+
氏名や点数の入力は別のクラスで行っています。
|
192
|
+
|
193
|
+
最高得点の科目を表示する部分以外はちゃんと実行できます。
|
4
直りましたか?
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
|
23
|
+
```java
|
24
24
|
|
25
25
|
|
26
26
|
|
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
}
|
46
46
|
|
47
|
-
|
47
|
+
```
|
48
48
|
|
49
49
|
### 試したこと
|
50
50
|
|
3
直りましたか?
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
|
23
|
+
'''java
|
24
24
|
|
25
25
|
|
26
26
|
|
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
}
|
46
46
|
|
47
|
-
|
47
|
+
'''
|
48
48
|
|
49
49
|
### 試したこと
|
50
50
|
|
2
直りましたか?
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,9 +20,7 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
,,,
|
24
|
-
|
25
|
-
java
|
23
|
+
,,,java
|
26
24
|
|
27
25
|
|
28
26
|
|
@@ -46,7 +44,7 @@
|
|
46
44
|
|
47
45
|
}
|
48
46
|
|
49
|
-
|
47
|
+
,,,
|
50
48
|
|
51
49
|
### 試したこと
|
52
50
|
|
1
直りましたか?
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,6 +20,8 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
+
,,,
|
24
|
+
|
23
25
|
java
|
24
26
|
|
25
27
|
|
@@ -32,9 +34,9 @@
|
|
32
34
|
|
33
35
|
for(int i=0; i==subjects.length; i++) {
|
34
36
|
|
35
|
-
if (getHighScore() == subjects[
|
37
|
+
if (getHighScore() == subjects[i]) {
|
36
38
|
|
37
|
-
st = String.join(",",maxsubject[
|
39
|
+
st = String.join(",",maxsubject[i]);
|
38
40
|
|
39
41
|
}
|
40
42
|
|