Tracks
/
Ruby
Ruby
/
Exercises
/
Microwave
Microwave

Microwave

Easy

Instructions

Your task is to convert the buttons entered on the microwave panel to their timer equivalent.

Digital microwave timers fill from the right. So if you press 1,0,0, the microwave reads this as "1:00" or 1 minute and 0 seconds. If you press 132, the microwave reads this as "1:32", or 1 minute and 32 seconds. Microwave timers are also smart enough to know that when you press "90", you mean 90 seconds, or "1:30".

We want to have a "smart display" that will convert this to the lowest form of minutes and seconds, rather than leaving it as 90 seconds.

Build a class that accepts buttons entered and converts them to the proper display panel time, converting whatever is entered to the lowest form of minutes and seconds.

Edit via GitHub The link opens in a new window or tab
Ruby Exercism

Ready to start Microwave?

Sign up to Exercism to learn and master Ruby with 20 concepts, 119 exercises, and real human mentoring, all for free.