Skip to content

Commit 1043993

Browse files
committed
s
1 parent c03eb67 commit 1043993

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/main/kotlin/mate/academy/Store.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package mate.academy
22

3-
class Store(var shoes: Int = 0, var shirts: Int = 0, var jackets: Int = 0) {
3+
class Store(var shoes: Int = 0,
4+
var shirts: Int = 0,
5+
var jackets: Int = 0) {
46
// Method to print out the inventory
57
fun printInventory(): String {
68
return """

src/main/kotlin/mate/academy/StoreService.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ package mate.academy
22

33
class StoreService {
44
// Function to update the store's stock with `with`
5-
fun updateStoreStock(store: Store, extraShoes: Int, extraShirts: Int, extraJackets: Int) {
6-
// TODO: implement
5+
fun updateStoreStock(store: Store,
6+
extraShoes: Int,
7+
extraShirts: Int,
8+
extraJackets: Int) {
9+
with(store) {
10+
shoes += extraShoes
11+
shirts += extraShirts
12+
jackets += extraJackets
13+
}
714
}
815
}

0 commit comments

Comments
 (0)