8 Replies Latest reply: Dec 2, 2007 8:50 PM by 807603

# Prime Number Programming

Compute all primes less than N, and display the results
step by step on the BlueJ terminal screen to show the working of your program. Upon
completion, you are to summarize the computed results in an easy-to-read format.
The program starts by asking for an integer value N from the user. Print out the initial matrix
of numbers from 2 to N.

To find all primes less than N, you should begin by making a table of integers from 2 to N.
Find the smallest integer i, that is NOT prime and NOT crossed out. Mark i as a prime
number and cross out 2i, 3i, 4i, �, ni N.

When i > N , the algorithm terminates.Screen is cleared once again,
before the program prints the final results in the matrix format.

Following are the requirements for the matrix format:
� The matrix consists of 10 columns
� The number of rows varies, depending on the input N
� Initial matrix: The program prints an empty string in place of 1
� Intermediate matrix: The program prints values for all prime numbers and numbers
that are not crossed out. The program prints an empty string for each crossed-out
number.
� Final matrix: The program prints only the prime numbers less than N

Must implement at least 3 classes for your program. Each of the classes should have
clear and distinct responsibilities associated with it.
• ###### 1. Re: Prime Number Programming
cross-posted:

Now how do I tell the original poster tactfully that he's acting like a lazy good-for-nothing jerk by posting his homework assignment? I never was too good at tact here.
• ###### 2. Re: Prime Number Programming
Tack isn't a real requirement in this case.
• ###### 3. Re: Prime Number Programming
He created an account on these forums, then cut-and-pasted his homework assignment into a post. That's probably the most work he's put into anything his whole life.
• ###### 4. Re: Prime Number Programming
I want to 3 class for the prime number.
• ###### 5. Re: Prime Number Programming
jagkajiclub wrote:
I want to 3 class for the prime number.
Most of us do not wish to help anyone who hasn't shown that they've first exerted major effort.

My suggestion to you: Show your code and ask specific questions about what in your code you don't understand. Otherwise you are just asking for someone to do your work for you, and here that just won't fly.
• ###### 6. Re: Prime Number Programming
jagkajiclub wrote:
repeat after me: "give me t3h codez!"
• ###### 7. Re: Prime Number Programming
petes1234 wrote:
jagkajiclub wrote: