PerfectNumber

Ratings: 1 Star2 Stars3 Stars4 Stars5 Stars (5.00 out of 5) - Rate Now!
Loading...

Download Category: ,

PerfectNumber.zip - (111.22 KB)
[
PerfectNumber/build.xml
PerfectNumber/build/
PerfectNumber/build/classes/
PerfectNumber/build/classes/.netbeans_automatic_build
PerfectNumber/build/classes/.netbeans_update_resources
PerfectNumber/build/classes/perfectnumber/
PerfectNumber/build/classes/perfectnumber/PerfectNumber.class
PerfectNumber/manifest.mf
PerfectNumber/nbproject/
PerfectNumber/nbproject/build-impl.xml
PerfectNumber/nbproject/genfiles.properties
PerfectNumber/nbproject/private/
PerfectNumber/nbproject/private/private.properties
PerfectNumber/nbproject/private/private.xml
PerfectNumber/nbproject/project.properties
PerfectNumber/nbproject/project.xml
PerfectNumber/PerfectNumber.png
PerfectNumber/Question.txt
PerfectNumber/src/
PerfectNumber/src/perfectnumber/
PerfectNumber/src/perfectnumber/PerfectNumber.java
]

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:

Remember to:
• 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.

Get a fresh solution of this question. Ask it now to our experts.
doubt

Ask Your Question

We have verified professionals who are ready to answer your question.

time

Save Time and Money

We choose experts who can quickly answer your question and that suit your budget.

download

Get Your Answer

Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.