q2-1からq2-4まで完了

This commit is contained in:
2026-09-11 13:46:07 +09:00
parent 2b2555f8e7
commit f74b2041e2
7 changed files with 34 additions and 7 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
Question02-Expressions/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/bin/

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Question02-Expressions</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -12,15 +12,17 @@ public class PTra02_01 {
int mulch; int mulch;
int div; int div;
int rem; int rem;
sum = 6 + 2;
// TODO 6+2を計算して結果を変数sumに代入してください // TODO 6+2を計算して結果を変数sumに代入してください
diff = 6 - 2;
// TODO 6-2を計算して結果を変数diffに代入してください // TODO 6-2を計算して結果を変数diffに代入してください
mulch = 6 * 2;
// TODO 6×2を計算して結果を変数mulchに代入してください // TODO 6×2を計算して結果を変数mulchに代入してください
div = 6 / 2;
// TODO 6÷2を計算して結果を変数divに代入してください // TODO 6÷2を計算して結果を変数divに代入してください
rem = 17 % 5;
// TODO 17÷5の余りを計算して変数remに代入してください // TODO 17÷5の余りを計算して変数remに代入してください
// 各変数の表示(編集しないでください) // 各変数の表示(編集しないでください)

View File

@@ -10,6 +10,7 @@ public class PTra02_02 {
String firstName = "太郎"; String firstName = "太郎";
String lastName = "山田"; String lastName = "山田";
System.out.println(lastName + firstName);
// TODO 苗字と名前をつなげて山田太郎と出力してください。 // TODO 苗字と名前をつなげて山田太郎と出力してください。
// ※ System.out.printlnを使うのは1回だけです。 // ※ System.out.printlnを使うのは1回だけです。

View File

@@ -8,9 +8,9 @@ public class PTra02_03 {
public static void main(String[] args) { public static void main(String[] args) {
int num = 10; int num = 10;
num = num + 5;
// TODO numに5を足した値をnumに代入してください // TODO numに5を足した値をnumに代入してください
// numの値を出力します(編集しないでください)。 // numの値を出力します(編集しないでください)。
// ※ 15と出力されれば正解です。 // ※ 15と出力されれば正解です。
System.out.println(num); System.out.println(num);

View File

@@ -9,7 +9,7 @@ public class PTra02_04 {
public static void main(String[] args) { public static void main(String[] args) {
// TODO 以下のソースコードからコンパイルエラーを取り除いてください // TODO 以下のソースコードからコンパイルエラーを取り除いてください
// ※数値リテラル部分は編集しないでください // ※数値リテラル部分は編集しないでください
int sum = 10 + 3.14; double sum = 10 + 3.14;
// ※以下は編集しないでください。13.14と出力されていれば正解です // ※以下は編集しないでください。13.14と出力されていれば正解です
System.out.println(sum); System.out.println(sum);