質問編集履歴

4

訂正

2016/08/13 16:31

投稿

syosinsya12
syosinsya12

スコア69

test CHANGED
File without changes
test CHANGED
@@ -316,21 +316,21 @@
316
316
 
317
317
  public final static String EXTRA_KAS = "com.example.sample.name.KAS";
318
318
 
319
- public final static String A1_AVE = "com.example.sample.name.A1_AVE";
319
+ /* public final static String A1_AVE = "com.example.sample.name.A1_AVE";
320
320
 
321
321
  public final static String A1_PRO = "com.example.sample.name.A1_PRO";
322
322
 
323
323
  public final static String A2_AVE = "com.example.sample.name.A2_AVE";
324
324
 
325
- public final static String A2_PRO = "com.example.sample.name.A2_PRO";
325
+ public final static String A2_PRO = "com.example.sample.name.A2_PRO";*/
326
-
327
-
328
-
329
-
330
-
331
-
332
-
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
- Intent intent1 = getIntent();
333
+ /* Intent intent1 = getIntent();
334
334
 
335
335
  Double a1_ave = intent1.getDoubleExtra(A.A1_AVE);
336
336
 
@@ -338,61 +338,225 @@
338
338
 
339
339
  Double a2_ave = intent1.getDoubleExtra(A.A2_AVE);
340
340
 
341
+ Double a2_pro = intent1.getDoubleExtra(A.A2_PRO);*/
342
+
343
+
344
+
345
+
346
+
347
+ @Override
348
+
349
+ protected void onCreate(Bundle savedInstanceState) {
350
+
351
+ super.onCreate(savedInstanceState);
352
+
353
+ setContentView(R.layout.activity_input);
354
+
355
+ }
356
+
357
+ public void get_result (View view){
358
+
359
+ EditText kai = (EditText) findViewById(R.id.kai);
360
+
361
+ String kai1 =kai.getText().toString().trim();
362
+
363
+ EditText tou = (EditText) findViewById(R.id.tou);
364
+
365
+ String tou1 = tou.getText().toString().trim();
366
+
367
+ EditText kan = (EditText) findViewById(R.id.kan);
368
+
369
+ String kan1 = kan.getText().toString().trim();
370
+
371
+ EditText kas = (EditText) findViewById(R.id.kas);
372
+
373
+ String kas1 = kas.getText().toString().trim();
374
+
375
+ Intent intent = new Intent(this,Result.class);
376
+
377
+ intent.putExtra(EXTRA_KAI, kai1);
378
+
379
+ intent.putExtra(EXTRA_TOU, tou1);
380
+
381
+ intent.putExtra(EXTRA_KAN, kan1);
382
+
383
+ intent.putExtra(EXTRA_KAS, kas1);
384
+
385
+ /* intent.putExtra(A1_AVE,a1_pro);
386
+
387
+ intent.putExtra(A1_PRO,a1_pro);
388
+
389
+ intent.putExtra(A2_AVE,a2_ave);
390
+
391
+ intent.putExtra(A2_PRO,a2_pro);*/
392
+
393
+
394
+
395
+ startActivity(intent);
396
+
397
+ }
398
+
399
+ }
400
+
401
+
402
+
403
+ コード
404
+
405
+ ```
406
+
407
+
408
+
409
+ ```
410
+
411
+ <TableLayout>
412
+
413
+
414
+
415
+ <TableRow>
416
+
417
+ <TextView
418
+
419
+ android:text="@string/per1000"/>
420
+
421
+ <TextView
422
+
423
+ android:id="@+id/per1000"/>
424
+
425
+ <TextView
426
+
427
+ android:text="@string/kai"/>
428
+
429
+ </TableRow>
430
+
431
+
432
+
433
+ <TableRow>
434
+
435
+ <TextView
436
+
437
+ android:text="@string/per1"/>
438
+
439
+ <TextView
440
+
441
+ android:id="@+id/per1"/>
442
+
443
+ <TextView
444
+
445
+ android:text="@string/yen"/>
446
+
447
+ </TableRow>
448
+
449
+
450
+
451
+ <TableRow>
452
+
453
+ <TextView
454
+
455
+ android:text="@string/now"/>
456
+
457
+ <TextView
458
+
459
+ android:id="@+id/now"/>
460
+
461
+ <TextView
462
+
463
+ android:text="@string/yen"/>
464
+
465
+ </TableRow>
466
+
467
+ </TableLayout>
468
+
469
+
470
+
471
+
472
+
473
+ public class Result extends AppCompatActivity {
474
+
475
+
476
+
477
+ Intent intent1 = getIntent();
478
+
479
+ Double a1_ave = intent1.getDoubleExtra(A.A1_AVE);
480
+
481
+ Double a1_pro = intent1.getDoubleExtra(A.A1_PRO);
482
+
483
+ Double a2_ave = intent1.getDoubleExtra(A.A2_AVE);
484
+
341
485
  Double a2_pro = intent1.getDoubleExtra(A.A2_PRO);
342
486
 
343
487
 
344
488
 
345
-
346
-
347
489
  @Override
348
490
 
349
491
  protected void onCreate(Bundle savedInstanceState) {
350
492
 
351
493
  super.onCreate(savedInstanceState);
352
494
 
353
- setContentView(R.layout.activity_input);
354
-
355
- }
356
-
357
- public void get_result (View view){
358
-
359
- EditText kai = (EditText) findViewById(R.id.kai);
360
-
361
- String kai1 =kai.getText().toString().trim();
362
-
363
- EditText tou = (EditText) findViewById(R.id.tou);
364
-
365
- String tou1 = tou.getText().toString().trim();
366
-
367
- EditText kan = (EditText) findViewById(R.id.kan);
368
-
369
- String kan1 = kan.getText().toString().trim();
370
-
371
- EditText kas = (EditText) findViewById(R.id.kas);
372
-
373
- String kas1 = kas.getText().toString().trim();
374
-
375
- Intent intent = new Intent(this,Result.class);
376
-
377
- intent.putExtra(EXTRA_KAI, kai1);
378
-
379
- intent.putExtra(EXTRA_TOU, tou1);
380
-
381
- intent.putExtra(EXTRA_KAN, kan1);
382
-
383
- intent.putExtra(EXTRA_KAS, kas1);
384
-
385
- intent.putExtra(A1_AVE,a1_pro);
386
-
387
- intent.putExtra(A1_PRO,a1_pro);
388
-
389
- intent.putExtra(A2_AVE,a2_ave);
390
-
391
- intent.putExtra(A2_PRO,a2_pro);
392
-
393
-
394
-
395
- startActivity(intent);
495
+ setContentView(R.layout.activity_result);
496
+
497
+
498
+
499
+ Intent intent = getIntent();
500
+
501
+ String kai1 = intent.getStringExtra(Input.EXTRA_KAI);
502
+
503
+ String tou1 = intent.getStringExtra(Input.EXTRA_TOU);
504
+
505
+ String kan1 = intent.getStringExtra(Input.EXTRA_KAN);
506
+
507
+ String kas1 = intent.getStringExtra(Input.EXTRA_KAS);
508
+
509
+
510
+
511
+ /* Double a1_ave = intent.getDoubleExtra(Input.A1_AVE);
512
+
513
+ Double a1_pro = intent.getDoubleExtra(Input.A1_PRO);
514
+
515
+ Double a2_ave = intent.getDoubleExtra(Input.A2_AVE);
516
+
517
+ Double a2_pro = intent.getDoubleExtra(Input.A2_PRO);*/
518
+
519
+
520
+
521
+ double kai = Double.parseDouble(kai1);
522
+
523
+ double tou = Double.parseDouble(tou1);
524
+
525
+ double kan = Double.parseDouble(kan1);
526
+
527
+ double kas = Double.parseDouble(kas1);
528
+
529
+
530
+
531
+
532
+
533
+ double kait = kai / tou * 1000;
534
+
535
+ double kita = (Aで決めた値を入れたい ave) * kan / (Aで決めた値を入れたい pro) - tou / kai;
536
+
537
+ double kit = kita * kai;
538
+
539
+
540
+
541
+ String kait2 = String.valueOf(kait);
542
+
543
+ String kita2 = String.valueOf(kita);
544
+
545
+ String kit2 = String.valueOf(kit);
546
+
547
+
548
+
549
+ TextView kait3 = (TextView) findViewById(R.id.per1000);
550
+
551
+ kait3.setText(kait2);
552
+
553
+ TextView kita3 = (TextView) findViewById(R.id.per1);
554
+
555
+ kita3.setText(kita2);
556
+
557
+ TextView kit3 = (TextView) findViewById(R.id.now);
558
+
559
+ kit3.setText(kit2);
396
560
 
397
561
  }
398
562
 
@@ -403,155 +567,3 @@
403
567
  コード
404
568
 
405
569
  ```
406
-
407
-
408
-
409
- ```
410
-
411
- <TableLayout>
412
-
413
-
414
-
415
- <TableRow>
416
-
417
- <TextView
418
-
419
- android:text="@string/per1000"/>
420
-
421
- <TextView
422
-
423
- android:id="@+id/per1000"/>
424
-
425
- <TextView
426
-
427
- android:text="@string/kai"/>
428
-
429
- </TableRow>
430
-
431
-
432
-
433
- <TableRow>
434
-
435
- <TextView
436
-
437
- android:text="@string/per1"/>
438
-
439
- <TextView
440
-
441
- android:id="@+id/per1"/>
442
-
443
- <TextView
444
-
445
- android:text="@string/yen"/>
446
-
447
- </TableRow>
448
-
449
-
450
-
451
- <TableRow>
452
-
453
- <TextView
454
-
455
- android:text="@string/now"/>
456
-
457
- <TextView
458
-
459
- android:id="@+id/now"/>
460
-
461
- <TextView
462
-
463
- android:text="@string/yen"/>
464
-
465
- </TableRow>
466
-
467
- </TableLayout>
468
-
469
-
470
-
471
-
472
-
473
- public class Result extends AppCompatActivity {
474
-
475
-
476
-
477
- @Override
478
-
479
- protected void onCreate(Bundle savedInstanceState) {
480
-
481
- super.onCreate(savedInstanceState);
482
-
483
- setContentView(R.layout.activity_result);
484
-
485
-
486
-
487
- Intent intent = getIntent();
488
-
489
- String kai1 = intent.getStringExtra(Input.EXTRA_KAI);
490
-
491
- String tou1 = intent.getStringExtra(Input.EXTRA_TOU);
492
-
493
- String kan1 = intent.getStringExtra(Input.EXTRA_KAN);
494
-
495
- String kas1 = intent.getStringExtra(Input.EXTRA_KAS);
496
-
497
-
498
-
499
- Double a1_ave = intent.getDoubleExtra(Input.A1_AVE);
500
-
501
- Double a1_pro = intent.getDoubleExtra(Input.A1_PRO);
502
-
503
- Double a2_ave = intent.getDoubleExtra(Input.A2_AVE);
504
-
505
- Double a2_pro = intent.getDoubleExtra(Input.A2_PRO);
506
-
507
-
508
-
509
- double kai = Double.parseDouble(kai1);
510
-
511
- double tou = Double.parseDouble(tou1);
512
-
513
- double kan = Double.parseDouble(kan1);
514
-
515
- double kas = Double.parseDouble(kas1);
516
-
517
-
518
-
519
-
520
-
521
- double kait = kai / tou * 1000;
522
-
523
- double kita = (Aで決めた値を入れたい ave) * kan / (Aで決めた値を入れたい pro) - tou / kai;
524
-
525
- double kit = kita * kai;
526
-
527
-
528
-
529
- String kait2 = String.valueOf(kait);
530
-
531
- String kita2 = String.valueOf(kita);
532
-
533
- String kit2 = String.valueOf(kit);
534
-
535
-
536
-
537
- TextView kait3 = (TextView) findViewById(R.id.per1000);
538
-
539
- kait3.setText(kait2);
540
-
541
- TextView kita3 = (TextView) findViewById(R.id.per1);
542
-
543
- kita3.setText(kita2);
544
-
545
- TextView kit3 = (TextView) findViewById(R.id.now);
546
-
547
- kit3.setText(kit2);
548
-
549
- }
550
-
551
- }
552
-
553
-
554
-
555
- コード
556
-
557
- ```

3

訂正

2016/08/13 16:31

投稿

syosinsya12
syosinsya12

スコア69

test CHANGED
File without changes
test CHANGED
@@ -326,6 +326,24 @@
326
326
 
327
327
 
328
328
 
329
+
330
+
331
+
332
+
333
+ Intent intent1 = getIntent();
334
+
335
+ Double a1_ave = intent1.getDoubleExtra(A.A1_AVE);
336
+
337
+ Double a1_pro = intent1.getDoubleExtra(A.A1_PRO);
338
+
339
+ Double a2_ave = intent1.getDoubleExtra(A.A2_AVE);
340
+
341
+ Double a2_pro = intent1.getDoubleExtra(A.A2_PRO);
342
+
343
+
344
+
345
+
346
+
329
347
  @Override
330
348
 
331
349
  protected void onCreate(Bundle savedInstanceState) {
@@ -334,18 +352,6 @@
334
352
 
335
353
  setContentView(R.layout.activity_input);
336
354
 
337
-
338
-
339
- Intent intent1 = getIntent();
340
-
341
- intent1.getDoubleExtra(A.A1_AVE);
342
-
343
- intent1.getDoubleExtra(A.A1_PRO);
344
-
345
- intent1.getDoubleExtra(A.A2_AVE);
346
-
347
- intent1.getDoubleExtra(A.A2_PRO);
348
-
349
355
  }
350
356
 
351
357
  public void get_result (View view){
@@ -376,13 +382,13 @@
376
382
 
377
383
  intent.putExtra(EXTRA_KAS, kas1);
378
384
 
379
- intent.putExtra(A1_AVE,A1_AVE);
385
+ intent.putExtra(A1_AVE,a1_pro);
380
-
386
+
381
- intent.putExtra(A1_PRO,A1_PRO);
387
+ intent.putExtra(A1_PRO,a1_pro);
382
-
388
+
383
- intent.putExtra(A2_AVE,A2_AVE);
389
+ intent.putExtra(A2_AVE,a2_ave);
384
-
390
+
385
- intent.putExtra(A2_PRO,A2_PRO);
391
+ intent.putExtra(A2_PRO,a2_pro);
386
392
 
387
393
 
388
394
 

2

訂正

2016/08/13 16:26

投稿

syosinsya12
syosinsya12

スコア69

test CHANGED
File without changes
test CHANGED
@@ -124,13 +124,13 @@
124
124
 
125
125
 
126
126
 
127
- Double a1_ave = 1218.0;
127
+ double a1_ave = 1218.0;
128
-
128
+
129
- Double a1_pro = 99.9;
129
+ double a1_pro = 99.9;
130
-
130
+
131
- Double a2_ave = 4562.0;
131
+ double a2_ave = 4562.0;
132
-
132
+
133
- Double a2_pro = 245.5;
133
+ double a2_pro = 245.5;
134
134
 
135
135
 
136
136
 
@@ -338,13 +338,13 @@
338
338
 
339
339
  Intent intent1 = getIntent();
340
340
 
341
- String a1_ave = intent1.getStringExtra(A.A1_AVE);
341
+ intent1.getDoubleExtra(A.A1_AVE);
342
-
342
+
343
- String a1_pro = intent1.getStringExtra(A.A1_PRO);
343
+ intent1.getDoubleExtra(A.A1_PRO);
344
-
344
+
345
- String a2_ave = intent1.getStringExtra(A.A2_AVE);
345
+ intent1.getDoubleExtra(A.A2_AVE);
346
-
346
+
347
- String a2_pro = intent1.getStringExtra(A.A2_PRO);
347
+ intent1.getDoubleExtra(A.A2_PRO);
348
348
 
349
349
  }
350
350
 
@@ -376,13 +376,13 @@
376
376
 
377
377
  intent.putExtra(EXTRA_KAS, kas1);
378
378
 
379
- intent.putExtra(A1_AVE,a1_ave);
379
+ intent.putExtra(A1_AVE,A1_AVE);
380
-
380
+
381
- intent.putExtra(A1_PRO,a1_pro);
381
+ intent.putExtra(A1_PRO,A1_PRO);
382
-
382
+
383
- intent.putExtra(A2_AVE,a2_ave);
383
+ intent.putExtra(A2_AVE,A2_AVE);
384
-
384
+
385
- intent.putExtra(A2_PRO,a2_pro);
385
+ intent.putExtra(A2_PRO,A2_PRO);
386
386
 
387
387
 
388
388
 
@@ -490,13 +490,13 @@
490
490
 
491
491
 
492
492
 
493
- String a1_ave = intent.getStringExtra(A.A1_AVE);
493
+ Double a1_ave = intent.getDoubleExtra(Input.A1_AVE);
494
-
494
+
495
- String a1_pro = intent.getStringExtra(A.A1_PRO);
495
+ Double a1_pro = intent.getDoubleExtra(Input.A1_PRO);
496
-
496
+
497
- String a2_ave = intent.getStringExtra(A.A2_AVE);
497
+ Double a2_ave = intent.getDoubleExtra(Input.A2_AVE);
498
-
498
+
499
- String a2_pro = intent.getStringExtra(A.A2_PRO);
499
+ Double a2_pro = intent.getDoubleExtra(Input.A2_PRO);
500
500
 
501
501
 
502
502
 

1

訂正

2016/08/13 15:16

投稿

syosinsya12
syosinsya12

スコア69

test CHANGED
File without changes
test CHANGED
@@ -20,127 +20,309 @@
20
20
 
21
21
 
22
22
 
23
- <ScrollView
23
+ <ScrollView>
24
+
25
+
26
+
27
+ <LinearLayout">
28
+
29
+
30
+
31
+
32
+
33
+ <Button
34
+
35
+ android:id="@+id/a1"
36
+
37
+ android:onClick="get_a1"
24
38
 
25
39
  android:layout_width="match_parent"
26
40
 
27
- android:layout_height="match_parent">
28
-
29
-
30
-
31
- <LinearLayout
32
-
33
- android:layout_width="match_parent"
34
-
35
- android:layout_height="match_parent"
41
+ android:layout_height="wrap_content"
36
-
42
+
37
- android:orientation="vertical">
43
+ android:text="@string/a1"/>
38
-
39
-
40
-
41
-
42
44
 
43
45
  <Button
44
46
 
45
- android:id="@+id/a1"
47
+ android:id="@+id/a2"
46
-
48
+
47
- android:onClick="get_a1"
49
+ android:onClick="get_a2"
48
50
 
49
51
  android:layout_width="match_parent"
50
52
 
51
53
  android:layout_height="wrap_content"
52
54
 
53
- android:text="@string/a1"/>
55
+ android:text="@string/a2"/>
54
56
 
55
57
  <Button
56
58
 
57
- android:id="@+id/a2"
59
+ android:id="@+id/a3"
58
-
60
+
59
- android:onClick="get_a2"
61
+ android:onClick="get_a3"
60
62
 
61
63
  android:layout_width="match_parent"
62
64
 
63
65
  android:layout_height="wrap_content"
64
66
 
65
- android:text="@string/a2"/>
67
+ android:text="@string/a3"/>
66
68
 
67
69
  <Button
68
70
 
69
- android:id="@+id/a3"
71
+ android:id="@+id/a4"
70
-
72
+
71
- android:onClick="get_a3"
73
+ android:onClick="get_a4"
72
74
 
73
75
  android:layout_width="match_parent"
74
76
 
75
77
  android:layout_height="wrap_content"
76
78
 
77
- android:text="@string/a3"/>
79
+ android:text="@string/a4"/>
80
+
81
+
78
82
 
79
83
  <Button
80
84
 
81
- android:id="@+id/a4"
85
+ android:id="@+id/a5"
82
-
86
+
83
- android:onClick="get_a4"
87
+ android:onClick="get_a5"
84
88
 
85
89
  android:layout_width="match_parent"
86
90
 
87
91
  android:layout_height="wrap_content"
88
92
 
89
- android:text="@string/a4"/>
93
+ android:text="@string/a5"/>
94
+
95
+
96
+
97
+
98
+
90
-
99
+ </LinearLayout>
100
+
101
+
102
+
91
-
103
+ </ScrollView>
104
+
105
+
106
+
107
+ </LinearLayout>
108
+
109
+
110
+
111
+
112
+
113
+ public class A extends AppCompatActivity {
114
+
115
+
116
+
117
+ public final static String A1_AVE = "com.example.sample.name.A1_AVE";
118
+
119
+ public final static String A1_PRO = "com.example.sample.name.A1_PRO";
120
+
121
+ public final static String A2_AVE = "com.example.sample.name.A1_AVE";
122
+
123
+ public final static String A2_PRO = "com.example.sample.name.A1_PRO";
124
+
125
+
126
+
127
+ Double a1_ave = 1218.0;
128
+
129
+ Double a1_pro = 99.9;
130
+
131
+ Double a2_ave = 4562.0;
132
+
133
+ Double a2_pro = 245.5;
134
+
135
+
136
+
137
+ @Override
138
+
139
+ protected void onCreate(Bundle savedInstanceState) {
140
+
141
+ super.onCreate(savedInstanceState);
142
+
143
+ setContentView(R.layout.activity_a);
144
+
145
+ }
146
+
147
+
148
+
149
+ public void get_a1 (View view){
150
+
151
+ Intent intent = new Intent(this,Input.class);
152
+
153
+ intent.putExtra(A1_AVE,a1_ave);
154
+
155
+ intent.putExtra(A1_PRO,a1_pro);
156
+
157
+ startActivity(intent);
158
+
159
+ }
160
+
161
+ public void get_a2 (View view){
162
+
163
+ Intent intent = new Intent(this,Input.class);
164
+
165
+ intent.putExtra(A2_AVE,a2_ave);
166
+
167
+ intent.putExtra(A2_PRO,a2_pro);
168
+
169
+ startActivity(intent);
170
+
171
+ }
172
+
173
+ public void get_a3 (View view){
174
+
175
+ Intent intent = new Intent(this,Input.class);
176
+
177
+ startActivity(intent);
178
+
179
+ }
180
+
181
+ public void get_a4 (View view){
182
+
183
+ Intent intent = new Intent(this,Input.class);
184
+
185
+ startActivity(intent);
186
+
187
+ }
188
+
189
+ public void get_a5 (View view){
190
+
191
+ Intent intent = new Intent(this,Input.class);
192
+
193
+ startActivity(intent);
194
+
195
+ }
196
+
197
+
198
+
199
+ }
200
+
201
+
202
+
203
+ コード
204
+
205
+ ```
206
+
207
+
208
+
209
+ ```
210
+
211
+ <TableLayout>
212
+
213
+
214
+
215
+ <TableRow>
216
+
217
+ <TextView
218
+
219
+ android:text="@string/kai"></TextView>
220
+
221
+
222
+
223
+ <EditText
224
+
225
+ android:id="@+id/kai"
226
+
227
+ android:layout_weight="1"
228
+
229
+ android:layout_height="wrap_content"
230
+
231
+ android:layout_width="0dp"/>
232
+
233
+ </TableRow>
234
+
235
+
236
+
237
+ <TableRow>
238
+
239
+ <TextView
240
+
241
+ android:text="@string/tou"></TextView>
242
+
243
+ <EditText
244
+
245
+ android:id="@+id/tou"
246
+
247
+ android:layout_weight="1"
248
+
249
+ android:layout_height="wrap_content"
250
+
251
+ android:layout_width="0dp"/>
252
+
253
+ </TableRow>
254
+
255
+ <TableRow>
256
+
257
+ <TextView
258
+
259
+ android:text="@string/kan"></TextView>
260
+
261
+ <EditText
262
+
263
+ android:id="@+id/kan"
264
+
265
+ android:layout_weight="1"
266
+
267
+ android:layout_height="wrap_content"
268
+
269
+ android:layout_width="0dp"/>
270
+
271
+ </TableRow>
272
+
273
+ <TableRow>
274
+
275
+ <TextView
276
+
277
+ android:text="@string/kas"></TextView>
278
+
279
+ <EditText
280
+
281
+ android:id="@+id/kas"
282
+
283
+ android:layout_weight="1"
284
+
285
+ android:layout_height="wrap_content"
286
+
287
+ android:layout_width="0dp"/>
288
+
289
+ </TableRow>
92
290
 
93
291
  <Button
94
292
 
95
- android:id="@+id/a5"
96
-
97
- android:onClick="get_a5"
293
+ android:onClick="get_result"
98
-
294
+
99
- android:layout_width="match_parent"
295
+ android:layout_width="wrap_content"
100
296
 
101
297
  android:layout_height="wrap_content"
102
298
 
103
- android:text="@string/a5"/>
299
+ android:text="@string/cul"/>
104
-
105
-
106
-
107
-
108
-
300
+
109
- </LinearLayout>
301
+ </TableLayout>
110
-
111
-
112
-
113
- </ScrollView>
302
+
114
-
115
-
116
-
117
- </LinearLayout>
303
+
118
-
119
-
120
-
121
-
122
-
304
+
305
+
306
+
123
- public class A extends AppCompatActivity {
307
+ public class Input extends AppCompatActivity {
308
+
309
+
310
+
124
-
311
+ public final static String EXTRA_KAI = "com.example.sample.name.KAI";
312
+
125
-
313
+ public final static String EXTRA_TOU = "com.example.sample.name.TOU";
314
+
315
+ public final static String EXTRA_KAN = "com.example.sample.name.KAN";
316
+
317
+ public final static String EXTRA_KAS = "com.example.sample.name.KAS";
126
318
 
127
319
  public final static String A1_AVE = "com.example.sample.name.A1_AVE";
128
320
 
129
321
  public final static String A1_PRO = "com.example.sample.name.A1_PRO";
130
322
 
131
- public final static String A2_AVE = "com.example.sample.name.A1_AVE";
323
+ public final static String A2_AVE = "com.example.sample.name.A2_AVE";
132
-
324
+
133
- public final static String A2_PRO = "com.example.sample.name.A1_PRO";
325
+ public final static String A2_PRO = "com.example.sample.name.A2_PRO";
134
-
135
-
136
-
137
- Double a1_ave = 1218.0;
138
-
139
- Double a1_pro = 99.9;
140
-
141
- Double a2_ave = 4562.0;
142
-
143
- Double a2_pro = 245.5;
144
326
 
145
327
 
146
328
 
@@ -150,62 +332,64 @@
150
332
 
151
333
  super.onCreate(savedInstanceState);
152
334
 
153
- setContentView(R.layout.activity_a);
335
+ setContentView(R.layout.activity_input);
336
+
337
+
338
+
154
-
339
+ Intent intent1 = getIntent();
340
+
341
+ String a1_ave = intent1.getStringExtra(A.A1_AVE);
342
+
343
+ String a1_pro = intent1.getStringExtra(A.A1_PRO);
344
+
345
+ String a2_ave = intent1.getStringExtra(A.A2_AVE);
346
+
347
+ String a2_pro = intent1.getStringExtra(A.A2_PRO);
348
+
155
- }
349
+ }
156
-
157
-
158
-
350
+
159
- public void get_a1 (View view){
351
+ public void get_result (View view){
352
+
160
-
353
+ EditText kai = (EditText) findViewById(R.id.kai);
354
+
355
+ String kai1 =kai.getText().toString().trim();
356
+
357
+ EditText tou = (EditText) findViewById(R.id.tou);
358
+
359
+ String tou1 = tou.getText().toString().trim();
360
+
361
+ EditText kan = (EditText) findViewById(R.id.kan);
362
+
363
+ String kan1 = kan.getText().toString().trim();
364
+
365
+ EditText kas = (EditText) findViewById(R.id.kas);
366
+
367
+ String kas1 = kas.getText().toString().trim();
368
+
161
- Intent intent = new Intent(this,Input.class);
369
+ Intent intent = new Intent(this,Result.class);
370
+
371
+ intent.putExtra(EXTRA_KAI, kai1);
372
+
373
+ intent.putExtra(EXTRA_TOU, tou1);
374
+
375
+ intent.putExtra(EXTRA_KAN, kan1);
376
+
377
+ intent.putExtra(EXTRA_KAS, kas1);
162
378
 
163
379
  intent.putExtra(A1_AVE,a1_ave);
164
380
 
165
381
  intent.putExtra(A1_PRO,a1_pro);
166
382
 
383
+ intent.putExtra(A2_AVE,a2_ave);
384
+
385
+ intent.putExtra(A2_PRO,a2_pro);
386
+
387
+
388
+
167
389
  startActivity(intent);
168
390
 
169
391
  }
170
392
 
171
- public void get_a2 (View view){
172
-
173
- Intent intent = new Intent(this,Input.class);
174
-
175
- intent.putExtra(A2_AVE,a2_ave);
176
-
177
- intent.putExtra(A2_PRO,a2_pro);
178
-
179
- startActivity(intent);
180
-
181
- }
182
-
183
- public void get_a3 (View view){
184
-
185
- Intent intent = new Intent(this,Input.class);
186
-
187
- startActivity(intent);
188
-
189
- }
190
-
191
- public void get_a4 (View view){
192
-
193
- Intent intent = new Intent(this,Input.class);
194
-
195
- startActivity(intent);
196
-
197
- }
198
-
199
- public void get_a5 (View view){
200
-
201
- Intent intent = new Intent(this,Input.class);
202
-
203
- startActivity(intent);
204
-
205
- }
206
-
207
-
208
-
209
393
  }
210
394
 
211
395
 
@@ -226,87 +410,53 @@
226
410
 
227
411
  <TextView
228
412
 
229
- android:text="@string/kai"></TextView>
230
-
231
-
232
-
233
- <EditText
234
-
235
- android:id="@+id/kai"
236
-
237
- android:layout_weight="1"
238
-
239
- android:layout_height="wrap_content"
240
-
241
- android:layout_width="0dp"/>
242
-
243
- </TableRow>
244
-
245
-
246
-
247
- <TableRow>
248
-
249
- <TextView
250
-
251
- android:text="@string/tou"></TextView>
252
-
253
- <EditText
254
-
255
- android:id="@+id/tou"
256
-
257
- android:layout_weight="1"
258
-
259
- android:layout_height="wrap_content"
260
-
261
- android:layout_width="0dp"/>
262
-
263
- </TableRow>
264
-
265
- <TableRow>
266
-
267
- <TextView
268
-
269
- android:text="@string/kan"></TextView>
270
-
271
- <EditText
272
-
273
- android:id="@+id/kan"
274
-
275
- android:layout_weight="1"
276
-
277
- android:layout_height="wrap_content"
278
-
279
- android:layout_width="0dp"/>
280
-
281
- </TableRow>
282
-
283
- <TableRow>
284
-
285
- <TextView
286
-
287
- android:text="@string/kas"></TextView>
288
-
289
- <EditText
290
-
291
- android:id="@+id/kas"
292
-
293
- android:layout_weight="1"
294
-
295
- android:layout_height="wrap_content"
296
-
297
- android:layout_width="0dp"/>
298
-
299
- </TableRow>
300
-
301
- <Button
302
-
303
- android:onClick="get_result"
304
-
305
- android:layout_width="wrap_content"
306
-
307
- android:layout_height="wrap_content"
308
-
309
- android:text="@string/cul"/>
413
+ android:text="@string/per1000"/>
414
+
415
+ <TextView
416
+
417
+ android:id="@+id/per1000"/>
418
+
419
+ <TextView
420
+
421
+ android:text="@string/kai"/>
422
+
423
+ </TableRow>
424
+
425
+
426
+
427
+ <TableRow>
428
+
429
+ <TextView
430
+
431
+ android:text="@string/per1"/>
432
+
433
+ <TextView
434
+
435
+ android:id="@+id/per1"/>
436
+
437
+ <TextView
438
+
439
+ android:text="@string/yen"/>
440
+
441
+ </TableRow>
442
+
443
+
444
+
445
+ <TableRow>
446
+
447
+ <TextView
448
+
449
+ android:text="@string/now"/>
450
+
451
+ <TextView
452
+
453
+ android:id="@+id/now"/>
454
+
455
+ <TextView
456
+
457
+ android:text="@string/yen"/>
458
+
459
+ </TableRow>
310
460
 
311
461
  </TableLayout>
312
462
 
@@ -314,21 +464,7 @@
314
464
 
315
465
 
316
466
 
317
- public class Input extends AppCompatActivity {
467
+ public class Result extends AppCompatActivity {
318
-
319
-
320
-
321
- public final static String EXTRA_KAI = "com.example.sample.name.KAI";
322
-
323
- public final static String EXTRA_TOU = "com.example.sample.name.TOU";
324
-
325
- public final static String EXTRA_KAN = "com.example.sample.name.KAN";
326
-
327
- public final static String EXTRA_KAS = "com.example.sample.name.KAS";
328
-
329
-
330
-
331
-
332
468
 
333
469
 
334
470
 
@@ -338,53 +474,71 @@
338
474
 
339
475
  super.onCreate(savedInstanceState);
340
476
 
341
- setContentView(R.layout.activity_input);
342
-
343
-
344
-
345
- Intent intent1 = getIntent();
346
-
347
- String a1_ave = intent1.getStringExtra(A.A1_AVE);
348
-
349
- String a1_pro = intent1.getStringExtra(A.A1_PRO);
350
-
351
- String a2_ave = intent1.getStringExtra(A.A2_AVE);
352
-
353
- String a2_pro = intent1.getStringExtra(A.A2_PRO);
354
-
355
- }
356
-
357
- public void get_result (View view){
358
-
359
- EditText kai = (EditText) findViewById(R.id.kai);
360
-
361
- String kai1 =kai.getText().toString().trim();
362
-
363
- EditText tou = (EditText) findViewById(R.id.tou);
364
-
365
- String tou1 = tou.getText().toString().trim();
366
-
367
- EditText kan = (EditText) findViewById(R.id.kan);
368
-
369
- String kan1 = kan.getText().toString().trim();
370
-
371
- EditText kas = (EditText) findViewById(R.id.kas);
372
-
373
- String kas1 = kas.getText().toString().trim();
374
-
375
- Intent intent = new Intent(this,Result.class);
376
-
377
- intent.putExtra(EXTRA_KAI, kai1);
378
-
379
- intent.putExtra(EXTRA_TOU, tou1);
380
-
381
- intent.putExtra(EXTRA_KAN, kan1);
382
-
383
- intent.putExtra(EXTRA_KAS, kas1);
384
-
385
-
386
-
387
- startActivity(intent);
477
+ setContentView(R.layout.activity_result);
478
+
479
+
480
+
481
+ Intent intent = getIntent();
482
+
483
+ String kai1 = intent.getStringExtra(Input.EXTRA_KAI);
484
+
485
+ String tou1 = intent.getStringExtra(Input.EXTRA_TOU);
486
+
487
+ String kan1 = intent.getStringExtra(Input.EXTRA_KAN);
488
+
489
+ String kas1 = intent.getStringExtra(Input.EXTRA_KAS);
490
+
491
+
492
+
493
+ String a1_ave = intent.getStringExtra(A.A1_AVE);
494
+
495
+ String a1_pro = intent.getStringExtra(A.A1_PRO);
496
+
497
+ String a2_ave = intent.getStringExtra(A.A2_AVE);
498
+
499
+ String a2_pro = intent.getStringExtra(A.A2_PRO);
500
+
501
+
502
+
503
+ double kai = Double.parseDouble(kai1);
504
+
505
+ double tou = Double.parseDouble(tou1);
506
+
507
+ double kan = Double.parseDouble(kan1);
508
+
509
+ double kas = Double.parseDouble(kas1);
510
+
511
+
512
+
513
+
514
+
515
+ double kait = kai / tou * 1000;
516
+
517
+ double kita = (Aで決めた値を入れたい ave) * kan / (Aで決めた値を入れたい pro) - tou / kai;
518
+
519
+ double kit = kita * kai;
520
+
521
+
522
+
523
+ String kait2 = String.valueOf(kait);
524
+
525
+ String kita2 = String.valueOf(kita);
526
+
527
+ String kit2 = String.valueOf(kit);
528
+
529
+
530
+
531
+ TextView kait3 = (TextView) findViewById(R.id.per1000);
532
+
533
+ kait3.setText(kait2);
534
+
535
+ TextView kita3 = (TextView) findViewById(R.id.per1);
536
+
537
+ kita3.setText(kita2);
538
+
539
+ TextView kit3 = (TextView) findViewById(R.id.now);
540
+
541
+ kit3.setText(kit2);
388
542
 
389
543
  }
390
544
 
@@ -395,211 +549,3 @@
395
549
  コード
396
550
 
397
551
  ```
398
-
399
-
400
-
401
- ```
402
-
403
- <TableLayout>
404
-
405
-
406
-
407
- <TableRow
408
-
409
- android:layout_marginTop="40dp">
410
-
411
- <TextView
412
-
413
- android:layout_height="wrap_content"
414
-
415
- android:layout_width="wrap_content"
416
-
417
- android:textSize="20dp"
418
-
419
- android:text="@string/per1000"/>
420
-
421
- <TextView
422
-
423
- android:id="@+id/per1000"
424
-
425
- android:textSize="20dp"
426
-
427
- android:layout_height="wrap_content"
428
-
429
- android:layout_width="wrap_content"/>
430
-
431
- <TextView
432
-
433
- android:layout_height="wrap_content"
434
-
435
- android:layout_width="wrap_content"
436
-
437
- android:textSize="20dp"
438
-
439
- android:text="@string/kai"/>
440
-
441
- </TableRow>
442
-
443
-
444
-
445
- <TableRow>
446
-
447
- <TextView
448
-
449
- android:layout_height="wrap_content"
450
-
451
- android:layout_width="wrap_content"
452
-
453
- android:textSize="20dp"
454
-
455
- android:text="@string/per1"/>
456
-
457
- <TextView
458
-
459
- android:id="@+id/per1"
460
-
461
- android:textSize="20dp"
462
-
463
- android:layout_height="wrap_content"
464
-
465
- android:layout_width="wrap_content"/>
466
-
467
- <TextView
468
-
469
- android:layout_height="wrap_content"
470
-
471
- android:layout_width="wrap_content"
472
-
473
- android:textSize="20dp"
474
-
475
- android:text="@string/yen"/>
476
-
477
- </TableRow>
478
-
479
-
480
-
481
- <TableRow>
482
-
483
- <TextView
484
-
485
- android:layout_height="wrap_content"
486
-
487
- android:layout_width="wrap_content"
488
-
489
- android:textSize="20dp"
490
-
491
- android:text="@string/now"/>
492
-
493
- <TextView
494
-
495
- android:id="@+id/now"
496
-
497
- android:textSize="20dp"
498
-
499
- android:layout_height="wrap_content"
500
-
501
- android:layout_width="wrap_content"/>
502
-
503
- <TextView
504
-
505
- android:layout_height="wrap_content"
506
-
507
- android:layout_width="wrap_content"
508
-
509
- android:textSize="20dp"
510
-
511
- android:text="@string/yen"/>
512
-
513
- </TableRow>
514
-
515
- </TableLayout>
516
-
517
-
518
-
519
-
520
-
521
- public class Result extends AppCompatActivity {
522
-
523
-
524
-
525
- @Override
526
-
527
- protected void onCreate(Bundle savedInstanceState) {
528
-
529
- super.onCreate(savedInstanceState);
530
-
531
- setContentView(R.layout.activity_result);
532
-
533
-
534
-
535
- Intent intent = getIntent();
536
-
537
- String kai1 = intent.getStringExtra(Input.EXTRA_KAI);
538
-
539
- String tou1 = intent.getStringExtra(Input.EXTRA_TOU);
540
-
541
- String kan1 = intent.getStringExtra(Input.EXTRA_KAN);
542
-
543
- String kas1 = intent.getStringExtra(Input.EXTRA_KAS);
544
-
545
-
546
-
547
- String a1_ave = intent.getStringExtra(A.A1_AVE);
548
-
549
- String a1_pro = intent.getStringExtra(A.A1_PRO);
550
-
551
- String a2_ave = intent.getStringExtra(A.A2_AVE);
552
-
553
- String a2_pro = intent.getStringExtra(A.A2_PRO);
554
-
555
-
556
-
557
- double kai = Double.parseDouble(kai1);
558
-
559
- double tou = Double.parseDouble(tou1);
560
-
561
- double kan = Double.parseDouble(kan1);
562
-
563
- double kas = Double.parseDouble(kas1);
564
-
565
-
566
-
567
-
568
-
569
- double kait = kai / tou * 1000;
570
-
571
- double kita = (Aで決めた値を入れたい ave) * kan / (Aで決めた値を入れたい pro) - tou / kai;
572
-
573
- double kit = kita * kai;
574
-
575
-
576
-
577
- String kait2 = String.valueOf(kait);
578
-
579
- String kita2 = String.valueOf(kita);
580
-
581
- String kit2 = String.valueOf(kit);
582
-
583
-
584
-
585
- TextView kait3 = (TextView) findViewById(R.id.per1000);
586
-
587
- kait3.setText(kait2);
588
-
589
- TextView kita3 = (TextView) findViewById(R.id.per1);
590
-
591
- kita3.setText(kita2);
592
-
593
- TextView kit3 = (TextView) findViewById(R.id.now);
594
-
595
- kit3.setText(kit2);
596
-
597
- }
598
-
599
- }
600
-
601
-
602
-
603
- コード
604
-
605
- ```