forked from root/public
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.
976 B
976 B
fooddeliverytime
Instructions
Given a menu with the corresponding time that each item takes to cook (burger takes 15 min, chips takes 10 min and nuggets takes 12 min), return the time each item takes to be prepared and the total amount of time for the order to be ready assuming the items are cooked one after the other.
Write a function FoodDeliveryTime()
that takes a string
and returns an int
.
- Use structures to answer the subject.
Expected function
type food struct {
preptime int
}
func FoodDeliveryTime(order string) int {
}
Usage
Here is a possible program to test your function:
package main
import "fmt"
func main() {
fmt.Println(FoodDeliveryTime("burger"))
fmt.Println(FoodDeliveryTime("chips"))
fmt.Println(FoodDeliveryTime("nuggets"))
fmt.Println(FoodDeliveryTime("burger") + FoodDeliveryTime("chips") + FoodDeliveryTime("nuggets"))
}
And its output:
$ go run . | cat -e
15$
10$
12$
37$