2019-08-21 23:53:47 +03:00

24 lines
430 B
Go

// 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
price money
}
func (p *puzzle) print() {
fmt.Printf("%-15s: %s\n", p.title, p.price.string())
}
func (p *puzzle) discount(ratio float64) {
p.price *= money(1 - ratio)
}