akosiraff

Download PerfectNumber

Feb 5th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1.  
  2. Download: https://solutionzip.com/downloads/perfectnumber/
  3. 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.
  4. For example, 6 is a perfect number because 1 + 2 + 3 = 6.
  5. 28 is a perfect number because 14 + 7 + 4 + 2 + 1 = 28.
  6. The program should:
  7. • prompt the user for a positive number
  8. • print out if the number is a perfect number or not
  9. • then ask if the user would like to enter another number or quit.
  10. See sample below:
  11. Remember to:
  12. • put your name, COP 2800, Chapter 4 Assignment, and date in a comment block at the top of your file
  13. • comment your code
  14. • format your code so it is readable (proper indentation, white space, blank lines, etc.).
  15. Submit your .java file here when you have completed the assignment. Late assignments will not be accepted without an approved excuse.
  16. *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.
  17.  
  18. Download: https://solutionzip.com/downloads/perfectnumber/
Add Comment
Please, Sign In to add comment