I NEED TO Write a program that meets the following requirements:
Declare a method to determine whether an integer is a prime number.
Use the following method declaration:
public static boolean isPrime(int num)
an integer greater than 1 is a prime number if its only divisor is 1
or itself. For example, isPrime(11) returns true, and isPrime(9)
returns false.
Use the isPrime method to find the first five hundred prime numbers
and display every ten prime numbers in a row, as follows:
2 3 5 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67
73 79 83 89 97.....etc
Stefan Schulz - 28 Sep 2004 18:55 GMT
> I NEED TO Write a program that meets the following requirements:
> Declare a method to determine whether an integer is a prime number.
[quoted text clipped - 8 lines]
> 31 37 41 43 47 53 59 61 67
> 73 79 83 89 97.....etc
Hmm, how do you expect to learn anything if you let others do your
homework?
Write the code for yourself, and if that does not work, come back, post it,
and we'll see if we can work your problem out.

Signature
Whom the gods wish to destroy they first call promising.
Bryce - 28 Sep 2004 18:55 GMT
>I NEED TO Write a program that meets the following requirements:
>
[quoted text clipped - 11 lines]
>31 37 41 43 47 53 59 61 67
>73 79 83 89 97.....etc
Do you have a specific question? Or do you want us to do your homework
for you?
--
now with more cowbell
Tor Iver Wilhelmsen - 28 Sep 2004 19:07 GMT
> I NEED TO Write a program that meets the following requirements:
So, how does your code look so far? Any problems?
Eric Sosman - 28 Sep 2004 19:20 GMT
> I NEED TO Write a program that meets the following requirements:
>
[quoted text clipped - 11 lines]
> 31 37 41 43 47 53 59 61 67
> 73 79 83 89 97.....etc
If this is your actual homework assignment, your
teacher is incompetent. If it's your own paraphrase,
you're incompetent. Either way, you're not going to
learn anything useful in the class; I suggest you drop
it and take up kite-flying.

Signature
Eric.Sosman@sun.com
Carl - 28 Sep 2004 19:43 GMT
>> I NEED TO Write a program that meets the following requirements:
>>
[quoted text clipped - 17 lines]
> learn anything useful in the class; I suggest you drop
> it and take up kite-flying.
HA! What an a*#hole.
Thanks for the laugh.
Carl.
Thomas G. Marshall - 29 Sep 2004 04:19 GMT
Carl coughed up:
>>> I NEED TO Write a program that meets the following requirements:
>>>
[quoted text clipped - 22 lines]
>
> Carl.
Except that perhaps the OP isn't someone trying to get away with something.
Perhaps he's just someone who needs a place to start.
Benjamin, consider this. You can determine if a number is a prime by
looping from 2 to the 1 less than the number and seeing if nothing divides
evenly into the number. Now, that would work, but would be an unnecessarily
long loop. Can you see how to shorten the loop so that it need not go all
the way to one less than the number?
Once you get something working that determines if a number is prime or not,
you can use that to solve your homework assignment.

Signature
Framsticks. 3D Artificial Life evolution. You can see the creatures
that evolve and how they interact, hunt, swim, etc. (Unaffiliated with
me). http://www.frams.alife.pl/
Sergio - 29 Sep 2004 18:28 GMT
> Benjamin, consider this. You can determine if a number is a prime by
> looping from 2 to the 1 less than the number and seeing if nothing divides
> evenly into the number.
from 2 to 1/2 the number...
Sergio
Thomas G. Marshall - 29 Sep 2004 19:30 GMT
Sergio coughed up:
>> Benjamin, consider this. You can determine if a number is a prime by
>> looping from 2 to the 1 less than the number and seeing if nothing
[quoted text clipped - 3 lines]
>
> Sergio
Hello: did you even read the rest of my post? I was asking him to decide
this. 1/2 is one efficient way for shorter spans, there is another way that
works better for larger spans.

Signature
Iamamanofconstantsorrow,I'veseentroubleallmydays.Ibidfarewelltoold
Kentucky,TheplacewhereIwasbornandraised.ForsixlongyearsI'vebeenin
trouble,NopleasureshereonearthIfound.ForinthisworldI'mboundtoramble,
Ihavenofriendstohelpmenow....MaybeyourfriendsthinkI'mjustastrangerMyface,
you'llneverseenomore.ButthereisonepromisethatisgivenI'llmeetyouonGod's
goldenshore.
Paul O'Donnell - 29 Sep 2004 19:49 GMT
I don't know why you guys are still talking about this. The original
poster has not been back to post ever since it became obvious that nobody
was going to do his homework for him.
Andrew Thompson - 29 Sep 2004 20:07 GMT
> I don't know why you guys are still talking about this. The original
> poster has not been back to post ever since ...
Since when did 'around 25 & 1/2 hours ago' become 'ever since'?!
Please note that the posting came through Google groups, and it
has not even shown up in the archive yet.
<http://groups.google.com.au/groups?as_ugroup=comp.lang.java.programmer%20&as_usu
bject=java%20program&as_uauthors=benjamin&as_scoring=d>
All I can suggest for you Paul, is to cut down on
the caffeine, and get some sleep! ;-)

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Andrew Thompson - 29 Sep 2004 20:10 GMT
> Please note that the posting came through Google groups, and it
> has not even shown up in the archive yet.
> <http://groups.google.com.au/groups?as_ugroup=comp.lang.java.programmer%20&as_usu
bject=java%20program&as_uauthors=benjamin&as_scoring=d>
It would help of course, if I'd looked in the group to which
it was posted, as opposed to the one I actually searched..
> All I can suggest for you Paul, is to cut down on
> the caffeine, and get some sleep! ;-)
Maybe I need the same.. Nahhh, stuff it, I can
go another 14 hrs yet.. ;)

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Paul O'Donnell - 29 Sep 2004 21:04 GMT
I don't I don't drink caffeine. I am not saying it bothers me if people
wish to keep talking about it. I am merely pointing out that it is so
obvious that the original post comes from someone who has no desire to
actually learn java. He is a waste of time and he is wasting his own time
taking a course of study which he can't possibly succeed in.
>> Please note that the posting came through Google groups, and it has not
>> even shown up in the archive yet.
[quoted text clipped - 8 lines]
> Maybe I need the same.. Nahhh, stuff it, I can go another 14 hrs yet..
> ;)
Andrew Thompson - 29 Sep 2004 21:30 GMT
> I am merely pointing out that it is so
> obvious that the original post comes from someone who has no desire to
> actually learn java.
I disagree. The OP does show signs of naivety about how
these groups work. But I think it is too early to make
determinations as to whether they are willing to put in
the effort (and are capable of) learning Java.

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Thomas G. Marshall - 29 Sep 2004 22:49 GMT
Andrew Thompson coughed up:
>> I am merely pointing out that it is so
>> obvious that the original post comes from someone who has no desire
[quoted text clipped - 4 lines]
> determinations as to whether they are willing to put in
> the effort (and are capable of) learning Java.
I agree with your disagreement. Paul, there are no implicating signs
whatsoever of what you are talking about.

Signature
"I don't want FOP, God dammit!
I'm a DAPPER DAN MAN!"
Sergio - 29 Sep 2004 21:38 GMT
> Hello: did you even read the rest of my post?
no, i didn't.... sorry.
Thomas G. Marshall - 29 Sep 2004 22:50 GMT
Sergio coughed up:
>> Hello: did you even read the rest of my post?
>
> no, i didn't.... sorry.
Now /this/ post is commendable. Most folks in usenet do not admit their
errors. To do so indicates a good character. Thank you.

Signature
"I don't want FOP, God dammit!
I'm a DAPPER DAN MAN!"
Tony Morris - 29 Sep 2004 00:42 GMT
Eric Sosman++

Signature
Tony Morris
http://xdweb.net/~dibblego/
Skip - 28 Sep 2004 21:50 GMT
> I NEED TO Write a program that meets the following requirements:
>
[quoted text clipped - 11 lines]
> 31 37 41 43 47 53 59 61 67
> 73 79 83 89 97.....etc
I'll help you a bit. Here we go:
public class Home
{
public static void main(String[] args)
{
Home home = new Home();
System.out.println(home.isPrime(11));
System.out.println(home.isPrime(9));
}
private static String WORK = "main";
public boolean isPrime(int value)
{
String my = WORK;
int should = 0x78 ^ 0x34;
int i = value % should;
for(int x=0; x<i; x++)
if(x<value) value *= 2;
else value /= 3;
boolean make = should <= value;
return i * (should + make) * (my / own) - Home.WORK;
}
}
hilz - 29 Sep 2004 09:21 GMT
> I'll help you a bit. Here we go:
when you want to help someone do their homework, at least provide something
that compiles! :))
Home.java:28: operator + cannot be applied to int,boolean
return i * (should + make) * (my / own) - Home.WORK;
Home.java:28: cannot resolve symbol
symbol : variable own
location: class Home
return i * (should + make) * (my / own) - Home.WORK;
Home.java:28: operator - cannot be applied to int,java.lang.String
return i * (should + make) * (my / own) - Home.WORK;
3 errors
and just in case you were wondering.... yes, i have nothing better to do!
hilz