Purchase Solution

Java and Identification of Prime Number

Not what you're looking for?

Ask Custom Question

I have to write a Java program that meets the following requirements:

Declare a method to determine whether an integer is a prime number

Use the following method declarations:
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.

I have to use the isPrime method to find the first thousand prime numbers and display every ten prime numbers in a row, as follows:

2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67 61
73 79 83 89 97 ...
...
The input and output must use JOptionPane dialog and display boxes.

Purchase this Solution

Solution Summary

This solution contains a java program that identifies prime numbers in various scenarios, it also uses JOptionPane and display boxes.

Purchase this Solution


Free BrainMass Quizzes
Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.