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 (8)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
WarDust00
Level 22 , Iraq
22 September, 08:56
These exercises are missing the important thing which is asking the user to input. (Print the question)
Cronox79
Level 9 , Harker Heights, United States
29 June, 18:31
I dont get this assignment. is there someone that can help?
Steveo
Level 14 , London, United Kingdom
15 July, 18:35
you still need help?
Ali_Alshehri
Level 5 , Saudi Arabia
24 April, 04:24
Nice!
Mindaugas
Level 10 , Lithuania
21 March, 21:20
Task was not quite clear, I think you should remove second requirement and add in the end new requirement that only final number should be displayed.
vhunjek Director at Silikon Studio
26 December 2021, 12:13
Requirement #2 is not clear. It says that first should be displayed the entered number, not the result. If you do that, verifying wouldn't pass. Please change the requirement text to be non-ambiguous.
Roman
Level 41
10 January, 07:43
Please post your question with the attached solution in the section Help.
Hoist
Level 26 , San Diego, United States
21 September 2021, 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