All Questions
Tagged with math-expression-eval java
40 questions
4
votes
2
answers
334
views
Designing a basic Binary Expression Tree structure
Preface
I need to generate some algebraic expressions for math testing in elementary school. The test should generate a list of expressions compiled according to certain rules and check the ...
2
votes
1
answer
1k
views
Verifying Mathematical Expressions
This is a part of my calculator program. I have to check if the input entered by the user is a valid mathematical expression. The first check is performed by another program, where the program checks ...
8
votes
3
answers
499
views
JavaRPN calculator
I have found that there is a distinct lack of an RPN calculator available to me, so I decided to make my own. I am still adding new functions to it, but as of now, I would like to refactor my code.
...
6
votes
3
answers
16k
views
Evaluating a math expression given in string format
I am currently working on building a calculator using Java and JavaFX to practice my coding skills. I wrote the following methods to evaluate a given expression.
What can I improve? Is there ...
6
votes
3
answers
5k
views
Postfix calculator in Java
I made a postfix calculator in Java.
The code performs the functions I planned without problems, However, I'm not satisfied with it, because it's too verbose and I couldn't split it up into methods ...
4
votes
2
answers
4k
views
Calculate arithmetic expression represented by a string, in Java
I saw that interview question online and gave it a try:
Implement a function that gets a string which represents an arithmethic expression: contains only numbers or the the operators: '+', '-', '*', '/...
5
votes
2
answers
686
views
Converting Reverse Polish to Infix Notation in Java
I am trying to solve a programming challange that involves converting reverse polish notation to infix notation. For example: 1 3 + 2 4 5 - + / would be: ((1+3)/(2+(4-5))) My solution so far does work,...
6
votes
3
answers
3k
views
Reverse Polish Notation calculator with unit tests
I had an interview with a global company yesterday. They had given me a programming assignment. I shared my screen and I must have finished the task in 1.5 hours.
Task was programming Reverse Polish ...
3
votes
2
answers
6k
views
Simple calculator to evaluate arithmetic expressions
I've studied Java for 2 and a half months. Got bored and decided to make a basic calculator that takes any basic expression with 2 integers/doubles. E.g. 5.5x10, 5+5, 5-2.5, 6/2.
Is this a good way ...
1
vote
1
answer
632
views
Analyzing an arithmetic expression using stacks
I'm looking for some constructive (harsh) criticism of a homework I've done (the code works fine). Also Is there a better/another way to solve the exercise?
Exercise:
Read an arithmetic expression ...
6
votes
1
answer
3k
views
Java OO Design - Reverse Polish Notation Calculator
The following is my implementation of Reverse Polish Notation. I should have mentioned that this is for a coding question, which asked for unary, binary, ternary, etc. operations that also allows user-...
3
votes
1
answer
2k
views
OO design of Reverse Polish Notation Calculator
This solution focuses on the design of classes, not the actual push and pop stack part. I will include that part of the code as well. The current code has 2 operators (plus and minus).
If we add ...
3
votes
1
answer
2k
views
Validator for mathematical expressions in infix notation
The function belows validates if a mathematical expression, say 12 + 2 * (9 - 3) / 4, does not have operators that are next to each other. It returns ...
5
votes
1
answer
3k
views
Reading integers and evaluating an arithmetic operation in a string
This Java code is reading integers and arithmetic operations from a string and evaluating the arithmetic operation.
For example:
For the input "32+54*27*4/13", ...
3
votes
2
answers
3k
views
Infix expression (with negative numbers) to postfix
I am writing a class to evaluate an arithmetic expression, For now my class can convert an infix expression into postfix, it doesn't support exponents yet.
...