App field glidedRose by default

This commit is contained in:
Denys 2025-05-11 19:00:07 +12:00
parent 32edb8321c
commit cc7bbb5b6e
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,8 @@
package com.gildedrose
class App(private val glidedRose: GildedRose) {
import com.gildedrose.data.constants.ItemRepository
class App(private val glidedRose: GildedRose = GildedRose(ItemRepository.items)) {
fun printGlideRoseTable(days: Int) {
welcomeMessage()
repeat(days) { day ->

View File

@ -1,10 +1,8 @@
package com.gildedrose
import com.gildedrose.data.constants.ItemRepository
fun main(args: Array<String>) {
val app = App(GildedRose(ItemRepository.items))
val app = App()
val days = when {
args.isNotEmpty() -> Integer.parseInt(args[0]) + 1