Question
[IN JAVA] Write a program with a method isPerfect() and a method isPrime(). Each method has an int parameter and returns a boolean value indicating
[IN JAVA]
Write a program with a method isPerfect() and a method isPrime(). Each method has an int parameter and returns a boolean value indicating whether the parameter is perfect (or prime). (A perfect number is a number that is equal to the sum of its divisors, not including itself. For example, 6 is a perfect number, because its divisors are 1, 2, and 3, and 1 + 2 + 3 = 6.) In main(), repeatedly display a menu allowing the user to choose whether to display the prime numbers 1-1000, display the perfect numbers 1-10,000, or quit. Be sure to clearly label the output. Output the numbers 10 to a line.
Be sure to use good decomposition. main() should be around 11 lines of code or so.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started