-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlasagna.go
34 lines (28 loc) · 990 Bytes
/
lasagna.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"fmt"
)
const OvenTime = 40
func main() {
fmt.Println(RemainingOvenTime(30))
fmt.Println(PreparationTime(2))
fmt.Println(ElapsedTime(3, 20))
}
// RemainingOvenTime returns the remaining minutes based on the `actual` minutes already in the oven.
func RemainingOvenTime(actualMinutesInOven int) int {
var remainingTime int
remainingTime = OvenTime - actualMinutesInOven
return remainingTime
}
// PreparationTime calculates the time needed to prepare the lasagna based on the amount of layers.
func PreparationTime(numberOfLayers int) int {
var preparationTime int
preparationTime = 2 * numberOfLayers
return preparationTime
}
// ElapsedTime calculates the time elapsed cooking the lasagna. This time includes the preparation time and the time the lasagna is baking in the oven.
func ElapsedTime(numberOfLayers, actualMinutesInOven int) int {
var elapsedTime int
elapsedTime = PreparationTime(numberOfLayers) + actualMinutesInOven
return elapsedTime
}