Java Mathmatical Functions By User [duplicate]
up vote
-4
down vote
favorite
This question already has an answer here:
Evaluating a math expression given in string form [closed]
24 answers
so i wanted to ask how to make a method that receives from the user a Mathematical function represented by (x) like (x + 2), then receives a number which is (x) .. then return the result !! ..
Thnks.
java math
marked as duplicate by Carcigenicate, meowgoesthedog, Andreas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 9 at 21:03
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
-4
down vote
favorite
This question already has an answer here:
Evaluating a math expression given in string form [closed]
24 answers
so i wanted to ask how to make a method that receives from the user a Mathematical function represented by (x) like (x + 2), then receives a number which is (x) .. then return the result !! ..
Thnks.
java math
marked as duplicate by Carcigenicate, meowgoesthedog, Andreas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 9 at 21:03
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
6
You'll need to write an expression parser. This is quite a complicated project for a beginner.
– Carcigenicate
Nov 9 at 20:32
1
You should probably implement shunting yard and then build on top of that
– Tilman B. aka Nerdyyy
Nov 9 at 20:42
add a comment |
up vote
-4
down vote
favorite
up vote
-4
down vote
favorite
This question already has an answer here:
Evaluating a math expression given in string form [closed]
24 answers
so i wanted to ask how to make a method that receives from the user a Mathematical function represented by (x) like (x + 2), then receives a number which is (x) .. then return the result !! ..
Thnks.
java math
This question already has an answer here:
Evaluating a math expression given in string form [closed]
24 answers
so i wanted to ask how to make a method that receives from the user a Mathematical function represented by (x) like (x + 2), then receives a number which is (x) .. then return the result !! ..
Thnks.
This question already has an answer here:
Evaluating a math expression given in string form [closed]
24 answers
java math
java math
asked Nov 9 at 20:32
Maen Ibraigheth
6
6
marked as duplicate by Carcigenicate, meowgoesthedog, Andreas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 9 at 21:03
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Carcigenicate, meowgoesthedog, Andreas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 9 at 21:03
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
6
You'll need to write an expression parser. This is quite a complicated project for a beginner.
– Carcigenicate
Nov 9 at 20:32
1
You should probably implement shunting yard and then build on top of that
– Tilman B. aka Nerdyyy
Nov 9 at 20:42
add a comment |
6
You'll need to write an expression parser. This is quite a complicated project for a beginner.
– Carcigenicate
Nov 9 at 20:32
1
You should probably implement shunting yard and then build on top of that
– Tilman B. aka Nerdyyy
Nov 9 at 20:42
6
6
You'll need to write an expression parser. This is quite a complicated project for a beginner.
– Carcigenicate
Nov 9 at 20:32
You'll need to write an expression parser. This is quite a complicated project for a beginner.
– Carcigenicate
Nov 9 at 20:32
1
1
You should probably implement shunting yard and then build on top of that
– Tilman B. aka Nerdyyy
Nov 9 at 20:42
You should probably implement shunting yard and then build on top of that
– Tilman B. aka Nerdyyy
Nov 9 at 20:42
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
Here's a link that gives a example on how to implement the shunting yard algorithm for expression parsing:
https://eddmann.com/posts/shunting-yard-implementation-in-java/
You can use the ideas in this to build your expression parser and read the stack of commands using switch statements to perform the operation entered. Good luck on the project!
add a comment |
up vote
-2
down vote
If you mean what i think you do, you just need to make a function with a parameter, do the calculation and return the result.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Here's a link that gives a example on how to implement the shunting yard algorithm for expression parsing:
https://eddmann.com/posts/shunting-yard-implementation-in-java/
You can use the ideas in this to build your expression parser and read the stack of commands using switch statements to perform the operation entered. Good luck on the project!
add a comment |
up vote
0
down vote
Here's a link that gives a example on how to implement the shunting yard algorithm for expression parsing:
https://eddmann.com/posts/shunting-yard-implementation-in-java/
You can use the ideas in this to build your expression parser and read the stack of commands using switch statements to perform the operation entered. Good luck on the project!
add a comment |
up vote
0
down vote
up vote
0
down vote
Here's a link that gives a example on how to implement the shunting yard algorithm for expression parsing:
https://eddmann.com/posts/shunting-yard-implementation-in-java/
You can use the ideas in this to build your expression parser and read the stack of commands using switch statements to perform the operation entered. Good luck on the project!
Here's a link that gives a example on how to implement the shunting yard algorithm for expression parsing:
https://eddmann.com/posts/shunting-yard-implementation-in-java/
You can use the ideas in this to build your expression parser and read the stack of commands using switch statements to perform the operation entered. Good luck on the project!
answered Nov 9 at 20:49
Tim Hunter
663
663
add a comment |
add a comment |
up vote
-2
down vote
If you mean what i think you do, you just need to make a function with a parameter, do the calculation and return the result.
add a comment |
up vote
-2
down vote
If you mean what i think you do, you just need to make a function with a parameter, do the calculation and return the result.
add a comment |
up vote
-2
down vote
up vote
-2
down vote
If you mean what i think you do, you just need to make a function with a parameter, do the calculation and return the result.
If you mean what i think you do, you just need to make a function with a parameter, do the calculation and return the result.
answered Nov 9 at 20:45
Ists Cilveks
11
11
add a comment |
add a comment |
6
You'll need to write an expression parser. This is quite a complicated project for a beginner.
– Carcigenicate
Nov 9 at 20:32
1
You should probably implement shunting yard and then build on top of that
– Tilman B. aka Nerdyyy
Nov 9 at 20:42