Answer the question
In order to leave comments, you need to log in
How to make a calculator in Java read and display values immediately after clicking on (+.-.* or /) and not just after =?
Hello everyone, this is my first time posting. I recently started learning Java and decided to try making a calculator. The design of the application was made through Scene builder. In general, I get some kind of calculator, but I want to make it like on an iPhone, so that it looks something like this (entered the number x --> clicked on + --> entered the number y (y appeared instead of x on the screen) --> and then, regardless of what I clicked on *, -, / or +, first x was added to y and their sum was displayed on the screen, which already and will continue to multiply, divide, etc. I apologize if I explained it in a confusing way, but I hope that they can help me because I've been scratching my head for a few days now.Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Since no code is provided, I will also tell you in words:
Relatively speaking, write a method that performs operations and writes the result to a certain variable. For example, double result
Next, clicking on each button ( + - * /) triggers and calls a method that displays the previous result. Those. the above buttons play the role of the = button.
Something like this...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question