Sign in to follow this  
kyokai

[java] Problem with divisor program++fixed++

Recommended Posts

Alright...I'm working on a program for a summer assignment, and I need some help with it... I have to write a program that takes a positive integer as an input and displays a message box that includes wether or not the number is perfect, deficient, or abundent. I was given two methods to use... boolean isDivisor (int number, int divisor) and... int divisorSum (int number) A perfect number being a number that the sum of the divisors equals the number. 28 = 1+2+4+7+14 as an example of a perfect number. If the sum of the divisors is less than the number, it is deficient, if it is greater than the number, it is abundant. The part i'm having trouble with is using the methods, and also the math part of the problem. Many thanks in advance, Kyokai ++i got it figured out++ [Edited by - kyokai on September 6, 2006 9:24:56 PM]

Share this post


Link to post
Share on other sites
Note that we can't help with homework. Not sure if this is for a class or not, so here's some vague suggestion:

I'd start off by finding all divisors of the given number.

Edit: And just for clarification, are you counting 1 as a divisor? Are you counting a number as it's own divisor? Looks like yes then no for those questions, respectively, but just double checking.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this