3段階の追加問題終わりました

This commit is contained in:
2026-09-14 16:41:41 +09:00
parent 47cfdcf026
commit 4ef8fca04f
2 changed files with 10 additions and 1 deletions

View File

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

View File

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