Prime Numbers from n to m (Complete App)

Here are three videos to test the Java interface on the problem: printing prime numbers between the lower and upper limits given as input using your myMath class collection of methods and mathematical algorithms studied in class.

Here are three videos to test the Java interface on the problem:

Print prime numbers between the lower and upper limits given as input using your myMath class collection of methods and mathematical algorithms studied in class.

The following video is the initial test of the interface. I proceed step by step to verify whether the Java app program works. Rerun the lesson to learn how to solve the exercise. You can proceed differently from the video, but the effectiveness of the problem remains unique.

First video to check app swing object on Java app. IDE netbeans 7.2.1

The following video develops a MyMath class and the isPrime method (a method that returns true if the number is prime, otherwise false)

The exercise is not yet finished. The goal is to print prime numbers from n to m. The intermediate step I take is to print all numbers from n to m ... only later will I say with the isPrime instruction whether it is a prime or not.

public boolean IsPrime(int n)
{ // I assume all numbers are prime
// then I look for contradictions
boolean bPrime=true;
int fat=2;
while (fat<=(n/2) )
{
if (n%fat==0)
{
bPrime=false;
}
fat++;
}
return bPrime;
}

Here is the working solution to the problem

Here is the comprehensive code that I advise you not to install! Run the exercise by watching the video!