fork(1) download
  1. import java.util.Date
  2.  
  3. case class Goods(name: String, number: Int, amount: Int, price: Int, date: Date) {
  4. def cost = amount * price
  5. }
  6.  
  7. object Main extends App {
  8. val goods = Goods("Дилдо", 123, 5, 100, new Date())
  9. println(goods.cost + "$")
  10. println(goods.copy(price = 110).cost + "$")
  11. }
Success #stdin #stdout 0.37s 322240KB
stdin
Standard input is empty
stdout
500$
550$