25 lines
415 B
Go
25 lines
415 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 float64
|
||
|
}
|
||
|
|
||
|
func (p puzzle) print() {
|
||
|
fmt.Printf("%-15s: $%.2f \n", p.title, p.price)
|
||
|
}
|
||
|
|
||
|
// TODO: NEW
|
||
|
func (p puzzle) sum() float64 {
|
||
|
return p.price
|
||
|
}
|