Commit f994cd61 by Patryk Czarnik

Klasa Towar - jakiKoszt

parent 1a906809
......@@ -15,7 +15,11 @@ public class Towar {
@Override
public String toString() {
return "Towar [nazwa=" + nazwa + ", cena=" + cena + "]";
return String.format("Towar %s za cenę %.2f zł", nazwa, cena);
}
double jakiKoszt(int sztuk) {
return cena * sztuk;
}
}
......@@ -8,6 +8,8 @@ public class TowarProgram {
System.out.println(pralka);
System.out.println(odkurzacz);
System.out.println("3 pralki kosztują " + pralka.jakiKoszt(3));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment