0914 段階3 <余裕がある人向け>を追加

This commit is contained in:
2026-09-14 16:22:39 +09:00
parent 1b2d0829d1
commit ffe4c91806
2 changed files with 8 additions and 4 deletions

View File

@@ -23,11 +23,11 @@ public class BasicCheck3 {
for(int i=0;i<3;i++) {
items[i].sell(5);
System.out.println(items[i].name+" "+items[i].price+"円 残り"+items[i].stock+"個");
System.out.println("合計金額:"+items[i].totalPrice());
}
}

View File

@@ -8,4 +8,8 @@ public class Item {
this.stock = this.stock - amount;
}
public int totalPrice() {
return this.price*this.stock;
}
}