• 3
  • Locked
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
You can't complete this task, because you're not signed in.
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Cz Ferencz
Level 12 , Bucharest, Romania
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. 😋
Shashank Kumar
Level 3 , Jakarta, India
21 December 2022, 14:58
Check if it is correct