Select Page

Perfect Numbers
We consider an integer number as a perfect number if its factors (including 1, but not the number itself) total up to the number. For example, 6 is a perfect number because its factors (excluding 6) are: 1, 2, and 3, which total to 6.
Write a method (also known as functions in C++) named isPerfect that takes in one parameter named number, and return a String (the method’s return type MUST BE a String) containing the factors for the number that totals up to the number if the number is a perfect number. If the number is not a perfect number, have the method return a null string (do this with a simple: return null; statement).
Utilize this isPerfect method in a program that prompts the user for a maximum integer, so the program can display all perfect numbers from 2 to the maximum integer (be careful having the user pick a maximum integer bigger than 100000).
To be submitted:
The .java source file of your assignment (do not include the .class file – it is an unreadable binary file)