logo CodeStepByStep logo

findKeithNumbers

Language/Type: Java ArrayList collections
Author: Keith Schwarz (on 2017/06/23)

Write a method named findKeithNumbers that accepts minimum and maximum integers as parameters and prints all of the "Keith numbers in that range (inclusive) in the format shown below. See previous program isKeithNumber to learn the definition of a "Keith number." If the given range contains no Keith numbers, print no output. For example, the call of findKeithNumbers(47, 742); would print the following output:

47: [4, 7, 11, 18, 29, 47]
61: [6, 1, 7, 8, 15, 23, 38, 61]
75: [7, 5, 12, 17, 29, 46, 75]
197: [1, 9, 7, 17, 33, 57, 107, 197]
742: [7, 4, 2, 13, 19, 34, 66, 119, 219, 404, 742]
Method: Write a Java method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.