Question: The code must be well commented! Perfect Number (5 points) Instructions Write a program that has a method called perfect that takes in a single

The code must be well commented!

The code must be well commented! Perfect Number (5 points) Instructions Write

Perfect Number (5 points) Instructions Write a program that has a method called perfect that takes in a single positive integer. The method will determine if the integer is a perfect number. If it is a perfect number, it will return the Boolean value true; otherwise it will return false In you main method, use a Scanner object to read a positive integer. Then call the method perfect and pass in the read in integer. The main method will print the result (true or false) A perfect number is defined as a positive integer (>0) such that the sum of its factors (including 1, but not the number itself), add up to the number. For examplee 6 (the factors are 1, 2 and 3 and 1+2+3-6) is a perfect number. Similarly, 28 -1+2+4+7+14) is a perfect number. On the other hand, for example, 15 is nota perfect number because its factors 1, 3 and 5 do not add up to 15 Details Input 1 positive integer Output A boolean Example Sample Input Sample Output 6 true 15 false Problem3 Check It

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!