"Evaluator de expresii"
Creati o aplicatie (cu interfata grafica) de tip calculator care sa permita introducerea unei expresii in forma inordine (infix),
transformarea acesteia in forma postfix si evaluarea acesteia.
Aplicatia va fi disponibila pentru instalare dintr-o pagina Web, folosind Java Web Start.
Alte cerinte obligatorii ce trebuie implementate folosind serviciile oferite de JNLP API sunt:
- Expresiile introduse vor fi salvate intr-un fisier.
- Aplicatia va seta fiecare rezultat in clipboard.
- Aplicatia va permite deschiderea unei pagini HTML (help-ul), aflata pe server.
Converting Expression from Infix to Postfix using STACK
Algorithm
1) Examine the next element in the input.
2) If it is an operand, output it.
3) If it is opening parenthesis, push it on stack.
4) If it is an operator, then
i) If stack is empty, push operator on stack.
ii) If the top of the stack is opening parenthesis, push operator on stack.
iii) If it has higher priority than the top of stack, push operator on stack.
iv) Else pop the operator from the stack and output it, repeat step 4.
5) If it is a closing parenthesis, pop operators from the stack and output them until an opening parenthesis is encountered.
pop and discard the opening parenthesis.
6) If there is more input go to step 1
7) If there is no more input, unstack the remaining operators to output.