O GoConqr está de visual novo! Conte para nós o que você achou.

Módulo 14 de 16 · Mídia

Rest of the week

Kostas Diakogiannis

Rest of the week

F-8 Money until rest of the week calculator

Write a function that calculates how much money someone is going to earn until the end of the week by just accepting a number from 1 to 7 that represents the days of the week. (1 is for Monday, 2 for Tuesday, etc 7 is for Sunday).

Given someone earns 10$ per hour and his working schedule is this:

Monday: works 4 hours

Tuesday:  works 6 hours

Wednesday:  works 8 hours

Thursday: works 10 hours 

Saturday: works 2 hours

Fridays and Sundays  can have his days-off.

 

For example: if we execute calculateRestOfWeekMoney(3) The number 3 is passed as argument indicates that today is Wednesday so we calculate from Wednesday (included) until sunday.

With calculateRestOfWeekMoney(4) we start counting from thursday until sunday etc.

 

Rules: Write this in a re-usable way and without using a loop (recursive style maybe!).

Estimated time: 30 mins.

 

 

Instruções

Para avançar no curso, envie uma tentativa deste quiz. Você pode enviá-la depois da última pergunta.

Ir para o módulo escolhido

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?