Microwave Ovens

Microwave Ovens


There is a lunch place at your work with the 3 microwave ovens (Мicrowave1, Мicrowave2, Мicrowave3), which are the subclasses of the MicrowaveBase class. Every microwave can be controlled by a RemoteControl. The RemoteControl uses the next commands:

set_time("xx:xx"), where "xx:xx" - time in minutes and seconds, which shows how long the food will be warming up. For example: set_time("05:30");
add_time("Ns"), add_time("Nm"), where N - the number of seconds("s") or minutes("m"), which should be added to the current time;
del_time("Ns"), del_time("Nm"), where N - the amount of the seconds("s") or minutes("m"), which should be subtracted from the current time;
show_time() - shows the current time for the microwave.

The default time is 00:00. The time can't be less than 00:00 or greater than 90:00, even if add_time or del_time causes it.

Your task is to create a few classes - one for the MicrowaveBase, three for the three different microwaves, and one for the RemoteControl - just as described above. The RemoteControl will have 1 parameter - an instance of the Microwave (for example, RemoteControl(microwave_1), where microwave_1 = Microwave1()) that shows which Microwave should be controlled by the current RemoteControle. Only the third oven works properly and shows the full time. The other two have some flaws with their displays - the first shows '_' instead of the first digit and the second does the same with the last digit. They show time like this:

microwave_1 = Microwave1()
microwave_2 = Microwave2()
microwave_3 = Microwave3()

RemoteControl(microwave_1).show_time() == "_0:00"
RemoteControl(microwave_2).show_time() == "00:0_"
RemoteControl(microwave_3).show_time() == "00:00"

In this mission you could use the Bridge design pattern. Its main task is - to decouple an abstraction from its implementation so that the two can vary independently.


microwave_1 = Microwave1()
microwave_2 = Microwave2()
microwave_3 = Microwave3()

remote_control_1 = RemoteControl(microwave_1)

remote_control_2 = RemoteControl(microwave_2)
remote_control_3 = RemoteControl(microwave_3)
remote_control_1.show_time() == "_1:00"
remote_control_2.show_time() == "01:3_"
remote_control_3.show_time() == "01:40"

Input: methods of the RemoteControl class and time.

Output: time on the display of the microwave.

How it is used: For work with time.

Precondition: 00:00 <= time <= 90:00

Invalid hot key. Each hot key should be unique and valid
Hot keys:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.

<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in a moment
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission