Inkoop interview question

Write a code implementing the shown requirements(Live Coding session)