Write a multi-threaded Java program to print all numbers below 100,000 that are both prime and fibonacci number (some examples are 2, 3, 5, 13, etc.). Design a thread that generates prime numbers below 100,000 and writes them into a pipe. Design another thread that generates fibonacci numbers and writes them to another pipe. The main thread should read both the pipes to identify numbers common to both.
Hello ranchers please give an idea of how to implement above problem...
To me it looks like you are getting complicated when you don't need to. I thought this was an interesting problem, so I coded it earlier to see what I came up, after some research. I'd suggest making 3 classes: 1 that does the fibonacci numbers, one that figures the primes, and a third that will be used to compare the two. After you get those three classes functional, then I would look into integrating threads and pipes.
I suggest looking at this link, and the programs they designed.
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Joined: Apr 13, 2010
Thanks for the link.. I will try as you suggested and post back here later..
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com