Exercises & activities from the go workshop provided by Packt: https://courses.packtpub.com/courses/go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

38 lines
635 B

package main
import "fmt"
func main() {
// Main course
var total float64 = 2 * 13
fmt.Println("Sub:", total)
// Drinks
total = total + (4 * 2.25)
fmt.Println("Sub:", total)
// Discount
total = total - 5
fmt.Println("Sub:", total)
// 10% Tip
tip := total * 0.1
fmt.Println("Tip:", tip)
total = total + tip
fmt.Println("Total:", total)
// Split bill
split := total / 2
fmt.Println("Split:", split)
// Reward every 5th visit
visitCount := 24
visitCount = visitCount + 1
remainder := visitCount % 5
if remainder == 0 {
fmt.Println("With this visit, you've earned a reward.")
}
}