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.










share|improve this question













marked as duplicate by Carcigenicate, meowgoesthedog, Andreas java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

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














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.










share|improve this question













marked as duplicate by Carcigenicate, meowgoesthedog, Andreas java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

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












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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 9 at 20:32









Maen Ibraigheth

6




6




marked as duplicate by Carcigenicate, meowgoesthedog, Andreas java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

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 java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

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












  • 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












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!






share|improve this answer



























    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.






    share|improve this answer



























      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!






      share|improve this answer
























        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!






        share|improve this answer






















          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!






          share|improve this answer












          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!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 9 at 20:49









          Tim Hunter

          663




          663






















              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.






              share|improve this answer
























                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.






                share|improve this answer






















                  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.






                  share|improve this answer












                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 9 at 20:45









                  Ists Cilveks

                  11




                  11













                      Popular posts from this blog

                      How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                      Syphilis

                      Darth Vader #20