In a file called PerfectNumbers.java, write a solution to problem
7 in chapter 5 of the text. A perfect number is a positive integer N such that
the sum of the proper divisors of N is equal to N. For example, N = 28 is
a perfect number since the proper divisors of 28 are 1, 2, 4, 7, and 14, and 1 +
2 + 4 + 7 + 14 = 28. When the sum of the proper divisors of N is less than N,
the number N is called deficient. When the sum exceeds N, the number is
called abundant. Your program should take a positive integer N as input
and use a messageBox to display a message stating that the number is perfect,
deficient or abundant. You must define the following two methods:
- boolean isDivisior( int number, int divisor)
which returns true whenever the second parameter is a divisor of the first
parameter, and false otherwise.
- int divisorSum( int number) that returns the sum
of all proper divisors of the input parameter.
You should design and test your code incrementally, testing each piece as it
is created, rather than writing all the code and then trying to test it all
together.