Help with Java Please. Anyone good?

Live forum: http://forum.freeipodguide.com/viewtopic.php?t=48681

superintendent

20-11-2006 03:54:44

I am in computer science at the moment and we are supposed to do a few things for the semester "project" one of which is this
[quotec6356b13e3]
A perfect number is a positive integer such that the sum of the divisors equals the number. Thus, 28 = 1 + 2 + 4 + 7 + 14 is a perfect number. If the sum of the divisors is less than the number, it is deficient. If the sum exceeds the number, it is abundant. Write a program that takes a positive integer as input and displays a message box that indicates whether the number entered is perfect, deficient, or abundant. Your program should define the following two methods

boolean isDivisor (int number, int divisor)
int divisorSum (int number)

The method isDivisor returns true if the divisor parameter is a divisor of the number parameter, and false otherwise. The divisorSum mthod uses isDivisor to accumulate and return the sum of the proper divisors of the number parameter. Be sure to design and test the program incrementally; that is, verify that isDivisor works correctly before using it in divisorSum.
[/quotec6356b13e3]

This is just one of the project I am working on at the moment. I don't really know what the difficulty level of this is, I am assuming it is pretty basic for someone who is fluent in the language. So, if anyone would be willing to give any kind of help it would be greatly appreciated.

Thanks

mkpeaches

20-11-2006 04:32:19

go to planet-source-code.com for stuff like that ;)

http//planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1737&lngWId=2

superintendent

20-11-2006 04:47:56

Sweet, mkpeaches that site looks great.

+karma and thank you.

edit Haha, I just looked at that a bit more closely and there are a lot of thing s in there I still dont understand. I will try to learn some stuff off of that but most of it we havent learned yet.

mkpeaches

20-11-2006 04:48:58

2 karma dance2

dmorris68

20-11-2006 05:13:55

That program is incredibly simple to write, and if you're a CS major it should not be a problem, even if you're new to Java. The concepts are identical no matter the language, and that program requires very little of Java language features to write.

I code Java for a living, but I'm not in the habit of doing people's homework for them (or directing them to resources where they can copy someone else's work -- shame on you mkpeaches). If you get stuck with a specific Java question, feel free to ask, but I'm not going to actually show you how to do it. ;)

superintendent

20-11-2006 05:29:06

Yeah, I figured it was pretty simple dmorris. I am going to try to right the code completely first and if I get stuck anywhere, I will come back here.

EDIT Oh and I am not a CS major, still in highschool. wink

mkpeaches

20-11-2006 15:16:22

oh, i didnt mean that for him to copy, i thought he would look at the code and get an idea of how it works and then be able to do it by himself.