24 lines
430 B
Go
Raw Normal View History

// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
type puzzle struct {
title string
2019-08-21 23:53:47 +03:00
price money
}
func (p *puzzle) print() {
2019-08-21 23:53:47 +03:00
fmt.Printf("%-15s: %s\n", p.title, p.price.string())
}
func (p *puzzle) discount(ratio float64) {
2019-08-21 23:53:47 +03:00
p.price *= money(1 - ratio)
}