import javax.swing.JOptionPane void Zadanie4() { def result = [] def list = ["zero", "jeden", "dwa", "trzy", "cztery", "pięć", "sześć", "siedem", "osiem", "dziewięć"] def number = JOptionPane.&showInputDialog("Podaj liczbę") number.each { result.add(list["$it".toInteger()]) } println(result.join(" - ")) } void Zadanie5() { def emptyMap = [:].withDefault { 0 } while (true) { def product = JOptionPane.&showInputDialog("Podaj: nazwa produktu=cena") if (product == null || product.equals("")) break def productInfo = product.toLowerCase().tokenize("=") emptyMap[productInfo[0]] += productInfo[1].toInteger() } emptyMap.each { k, v -> println "${k}:${v}" } } Zadanie4() Zadanie5()