posted 14 years ago
Well, I think I asked the right question anyway. I thought your assignment was much more complicated.
I recommend you look for Java tutorials on "operators"; an operator, in general, is a symbol in the language that takes one or more values and does something with them to produce another value. Java has operators for the standard math operations, which is all I think you will need. There are also math "functions", which are methods that do similar, usually more advanced operations.
If, for example, you want to add two things, you would write a java statement such as;
The obvious operator is "+", and it does what you would expect it to do with y and z. After this statement, x will hold their sum.
You will also need to know about Java numeric types; int, float, and double. You can also look up more detailed explanations of those, but basically int (meaning integer) variables only hold whole numbers, and float and double variables hold "real" numbers, i.e. decimal numbers with whole and fractional parts. So you declare variables of these types with statements such as:
and then use them in statements like the one above.
You can also assign "literal" values to your variables; a statement such as "y = 5.5;" assigns that literal value to the variable y.
Is that a start on what you needed? This says nothing about how you get the values the user has entered, so I hope someone has covered that for you elsewhere.
rc