20261019
This commit is contained in:
@@ -12,7 +12,7 @@ public class Atm {
|
||||
if(credit < money) {
|
||||
System.out.println("預金残高不足です。現金の引き出しに失敗しました。");
|
||||
} else {
|
||||
System.out.println("ATMの残り残高はx" + (credit - money) + "です");
|
||||
System.out.println("ATMの残り残高はx" + (credit - wallet.money) + "です");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,16 @@ public class Question11_03 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO 自動生成されたメソッド・スタブ
|
||||
|
||||
//インスタンスの生成
|
||||
Student schooldate = new Student();
|
||||
|
||||
schooldate.name = "太郎";
|
||||
schooldate.group = "A";
|
||||
schooldate.teacher = "山田";
|
||||
|
||||
schooldate.studentProfile();
|
||||
schooldate.groupProfile();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
16
Question11-ConstructorAndStatic/src/main/java/Student.java
Normal file
16
Question11-ConstructorAndStatic/src/main/java/Student.java
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
public class Student {
|
||||
//フィールドの宣言
|
||||
String name;
|
||||
String group;
|
||||
String teacher;
|
||||
|
||||
//メソッドの生成
|
||||
public void studentProfile() {
|
||||
System.out.println(name + "は" + group + "教室の生徒です。");
|
||||
}
|
||||
|
||||
public void groupProfile() {
|
||||
System.out.println(group + "教室の担任は" + teacher + "先生です。");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user