exercism/go/lasagna/lasagna.go

20 lines
743 B
Go
Raw Permalink Normal View History

2024-11-12 14:33:28 +00:00
package lasagna
const OvenTime = 40
const LayerPreparationTime = 2
// RemainingOvenTime returns the remaining minutes based on the `actual` minutes already in the oven.
func RemainingOvenTime(actualMinutesInOven int) int {
return OvenTime - actualMinutesInOven
}
// PreparationTime calculates the time needed to prepare the lasagna based on the amount of layers.
func PreparationTime(numberOfLayers int) int {
return numberOfLayers * LayerPreparationTime
}
// 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 {
return PreparationTime(numberOfLayers) + actualMinutesInOven
}