Question: write a java program that will ask for a number, and tell you if it is perfect, imperfect deficient, or imperfect abundant. Definitions: A perfect

write a java program that will ask for a number, and tell you if it is perfect, imperfect deficient, or imperfect abundant.

Definitions:

A perfect number is a number which is equal to the sum of its proper factors.

For example 6 = 1 + 2 + 3

For example 28 = 1 + 2 + 4 + 7 + 14

A deficient number is a number which is greater than the sum of its proper factors.

For example 5 > 1

For example 27 > 1 + 3 + 9

An abundant number is a number which is less than the sum of its proper factors.

For example 12 < 1 + 2 + 3 + 4 + 6

For example 18 < 1 + 2 + 3 + 6 + 9

For example, a run of the program might look like this:

----------------

Welcome to the Perfect Number Tester

Enter a number (0 to quit): 6

The factors are 1, 2, 3

6 is perfect

Enter a number (0 to quit): 10

The factors are 1, 2, 5

10 is imperfect deficient

Enter a number (0 to quit): 40

The factors are 1, 2, 4, 5, 8, 10, 20

40 is imperfect abundant

Enter a number (0 to quit): 0

End

-----------------

The numbers must be integers.

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!