25 lines
539 B
Go
Raw Normal View History

// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
2019-10-30 19:34:44 +03:00
// For more tutorials : https://learngoprogramming.com
// In-person training : https://www.linkedin.com/in/inancgumus/
// Follow me on twitter: https://twitter.com/inancgumus
package main
import "fmt"
type game struct {
2019-08-23 17:07:45 +03:00
title string
price money
}
func (g *game) print() {
2019-08-21 23:53:47 +03:00
fmt.Printf("%-15s: %s\n", g.title, g.price.string())
}
func (g *game) discount(ratio float64) {
2019-08-21 23:53:47 +03:00
g.price *= money(1 - ratio)
}