First things first, you can compare your solution with some of the other calculator implementations in Java calculator implementations in Java on this site. :)
First things first, you can compare your solution with some of the other calculator implementations in Java on this site. :)
First things first, you can compare your solution with some of the other calculator implementations in Java on this site. :)
The usual approach for this kind of functionality is to re-think how your arithmetic methods take in two inputs to give you an output. Setting aside the float
-or-double
question float
-or-double
question, you should consider having methods like this:
The one thing that strikes out as odd to me in your code is the heavy reliance on static
fields and methods with void
return types. This indicates that while you seem to think you need inheritance here (when you don't, see above section), you have forgotten about how to make effective use of class methods to pass information around explicitly, instead choosing to rely on a global state global state.
The usual approach for this kind of functionality is to re-think how your arithmetic methods take in two inputs to give you an output. Setting aside the float
-or-double
question, you should consider having methods like this:
The one thing that strikes out as odd to me in your code is the heavy reliance on static
fields and methods with void
return types. This indicates that while you seem to think you need inheritance here (when you don't, see above section), you have forgotten about how to make effective use of class methods to pass information around explicitly, instead choosing to rely on a global state.
The usual approach for this kind of functionality is to re-think how your arithmetic methods take in two inputs to give you an output. Setting aside the float
-or-double
question, you should consider having methods like this:
The one thing that strikes out as odd to me in your code is the heavy reliance on static
fields and methods with void
return types. This indicates that while you seem to think you need inheritance here (when you don't, see above section), you have forgotten about how to make effective use of class methods to pass information around explicitly, instead choosing to rely on a global state.
You have a weird way of iterating through methods. Instead of using loop structures, you have your methods repeatedly calling each other at the end as such (// Here... // And Herehere.
):
Putting it togetheraltogether
You have a weird way of iterating through methods. Instead of using loop structures, you have your methods repeatedly calling each other at the end as such (// Here... // And Here.
):
Putting it together
You have a weird way of iterating through methods. Instead of using loop structures, you have your methods repeatedly calling each other at the end as such (// Here... // And here.
):