Question: Write a program that determines if the user cracked the code. The program should do the following steps ( check hackerrank for exact wording )
Write a program that determines if the user cracked the code. The program should do the following steps check hackerrank for exact wording:
Ask the user for their name and greet them.
Ask the user if they would like to crack the code. If the user enters no in any case the program should exit. Use return; to make the code end. If the user enters yes in any case the program should proceed to the next step. If the user enters anything else, the program should print an error message that the response is not supported and exit.
Ask the user to guess the code. The code consists of a number, then a String, then a number. Ask the user to enter each of these separately then read them in and store them in variables.
The first number must be or between and but not
The second string should have length
The third number should be greater than and even and have a remainder of when divided by
If the conditions are met, print a success message to the user. Otherwise, print a message that they failed to guess the code.
Compile and run code in NetBeans.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
