Tutorial Webpage for

Lecture Cloud- and Web-Technologies

Loading...

Configuration

Login

Please use user and password as given in the lecture! Please copy the editor's content, as it will be lost due to reloading of the page for the purpose of login.

Username:

Password:

PHP - Calculator Class

Develop a calculator class, which internally uses a stack. The stack can be filled with numbers using a push function. Furthermore, there should be functions for adding, subtracting, multiplying and dividing the two latest inserted numbers on the stack, and pushing the result again on the stack. If the stack contains only one element, the class should provide access to this element via a value function.

Editor

Please use the following editor for your exercise. You can run the content of the editor by clicking on the tab 'Run'...

Output of Editor Content

The result of running the editor content is as follows:

Output of the Solution

The output of the solution is as follows:

Solution

Please have a look at the solution only after you have finished working on your own solution. Otherwise the learn effect is much less.