Practice Problems in LOLGraphics/Problem I - Calculator

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Namer is a street cat from Beer Sheva, Israel. Like all street cats, it’s his dream to reach the Kingdom of Cats - a mansion with a beautiful garden on a floating island with everything a cat can ever wish for. However, not every cat is eligible to live in the Kingdom of Cats - cats have to first pass a test in LOLGraphics to be allowed to even enter the Kingdom. A cat that enters the Kingdom will feast with the King of Cats and then will pass another test in order to join the Order of the Tiger. Only members of the Order are allowed to live in the Kingdom of Cats.

Each year, a hot air balloon only visible to cats departs from a random city in the world. This year it departs from Istanbul. Namer left Beer Sheva towards the sea where he met a cat with a boat. The cat said that he doesn’t know how to program, and that he will take Namer free of charge if he programs a calculator in LOLGraphics for him. He also gave a page which reads as following:

If you program a calculator in LOLGraphics for me, I will take you to Istanbul for free. My requirements for the LOLGraphics calculator are as following:

First, the calculator should ask the user to enter two numbers, and then a mathematical operation (addition, subtraction, multination, division), and then it will print the result. For division, since LOLGraphics doesn’t support fractions, I want to see the integer result and the reminder. For 99/3 it will print 33 and 0, for 15/7 it will print 2 and 1.