Positive and negative numbers

  • 3
  • Locked
Use the keyboard to enter a number. If the number is positive, then double it. If the number is negative, add one. If the entered number is zero, display zero. Display the result on the screen.
You can't complete this task, because you're not signed in.
Comments (1)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Web Hack
Level 6 , San Diego, United States
21 September, 21:27
I created a "reader" object to name things in the object. It's built from the BufferReader 'stuff' provided by Java to use. Acquire the input variable then manipulate it. I started to scribble out some logic code described in the Tasks. It sounded like if / else could be used ... and we are in Level 3. Hints: the number needs to be greater > than 0 - if so x2 --- if negative number plus one