Menu
Coddy logo textTech

Recap Challenge #2

Lesson 11 of 19 in Coddy's Functions and Pointers in Golang course.

challenge icon

Challenge

Easy

Write a function called coffeeCost that calculates how much you spend on coffee over a specific period of time. 

The function takes two parameters: the first parameter is the coffee price, and the second parameter is the number of days you want to calculate. 

Note that every day you consume two coffee glasses, except on weekends when you consume three per day. 

Print the total cost for each given time.

The output should be like this, for example: “Total amount spent on coffee for 20 days: 135” where 20 is the number of days, and 135 is the calculated amount

Try it yourself

All lessons in Functions and Pointers in Golang