Question: This is a Java Homework 1- You will write a method to create a random number of n digits like a PIN code for an

This is a Java Homework

1- You will write a method to create a random number of n digits like a PIN code for an account. You will pass an integer parameter and your method will return a random number of that many digits. Your method will need to make sure that no consecutive digits are the same. Also, your method should not allow leading 0's; it should have exactly n digits. Example: If I pass 4 to your method, your method should be able to return 9364, but not 483(not enough digits) nor 1147 (consecutive 1's).

2- If you wrote 1 recursively, explain here how the parts of a recursive solution were accomplished.

3- Give an example (not given above) of a value that your method could return using a value passed other than 4. State the value passed and the value that could be returned.

4- Give an example (not given above) of a value that your method could NOT return using a value passed other than 4. State the value passed and the value that cannot be returned.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!