| Author |
Logical Operators
|
Debo Prez
Greenhorn
Joined: Sep 23, 2012
Posts: 3
|
|
I'm very new to Java and we have an assignment I can't figure out. If I can get some feedback or help on how to do it, it would be much appreciated. Thank you!
I am asked to modify this code to have float variables (which I have done) then I am to add a second pair of float variables, and include logical operators &&, and || to print out the results if both comparisons are true or either are true.
[Added code tags - see UseCodeTags for details]
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5868
|
|
So, what particular problems are you having?
Have you studied up on the && and || operators?
Can you come up with a sentence in English that tests whether both/either comparisons are true?
|
 |
Kemal Sokolovic
Bartender
Joined: Jun 19, 2010
Posts: 792
|
|
Check conditional operators on this page for more details.
[MODERATOR ACTION: Removed full code solution]
Kemal Sokolovic, please remember this site is NotACodeMill(←click).
|
The quieter you are, the more you are able to hear.
|
 |
Debo Prez
Greenhorn
Joined: Sep 23, 2012
Posts: 3
|
|
|
Thank you for the example and the link they were very helpful.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
|
|
Welcome to the Ranch
Why are you using floats? They should be reserved for instances where one can specifically cope with their imprecision. For example in colours, where you can use floats between 0.0f and 1.0f inclusive, but there are actually 256 different values in that range.
|
 |
 |
|
|
subject: Logical Operators
|
|
|