¡GoConqr estrena diseño! Cuéntanos qué te parece.

Módulo 14 de 16 · Multimedia

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.

 

 

Instrucciones

Para avanzar en el curso, envía un intento de este test. Puedes enviarlo después de la última pregunta.

Ir al módulo elegido

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?