Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Download: https://solutionzip.com/downloads/perfectnumber/
- 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.
- Download: https://solutionzip.com/downloads/perfectnumber/
Add Comment
Please, Sign In to add comment