Enter a name and age from the keyboard. If the age is in the range 18-28 (inclusive), then display ", you've been drafted for military service", where is the name entered earlier from the keyboard.
Example input:
Amigo
18
Example output:
Amigo, you've been drafted for military service
Conscription
- 3
Locked
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Cz Ferencz
18 May, 20:58
For the sake of exercises you could make a condition check if first keyboard input is a string and if it is not, not let the program run and make you try again. It is really simple. Something like asking for hasNextLine condition. Just for the sake of exercises. 😋
0
Shashank Kumar
21 December 2022, 14:58
Check if it is correct
+1