Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 25 or between 45 and 88 but not 68
The second string should have length 2
The third number should be greater than 0 and even and have a remainder of 3 when divided by 7.
If the 3 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions