Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions