Create a Java application that allows the user to repeatedly enter a number to find out if it is a perfect number. A perfect number is one that is equal to the sum of all of its positive divisors, excluding itself.
For example, 6 is a perfect number because 1 + 2 + 3 = 6.
28 is a perfect number because 14 + 7 + 4 + 2 + 1 = 28.
The program should:
• prompt the user for a positive number
• print out if the number is a perfect number or not
• then ask if the user would like to enter another number or quit.
See sample below:
• put your name, COP 2800, Chapter 4 Assignment, and date in a comment block at the top of your file
• comment your code
• format your code so it is readable (proper indentation, white space, blank lines, etc.).
Submit your .java file here when you have completed the assignment. Late assignments will not be accepted without an approved excuse.
*Hint: your program will contain a do-while loop for input while the user says yes, a for loop to loop through the divisors to determine if a number is perfect, and a user validation while loop to make sure input is a positive number.
Write a Review
Leave a reply Cancel reply
Ask Your Question
We have verified professionals who are ready to answer your question.
Save Time and Money
We choose experts who can quickly answer your question and that suit your budget.
Get Your Answer
Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.