I am trying to create a program that counts the Prime numbers then I will continue and use this second method in my main method.
I am confused how to count the Prime numbers. I just pulled the text from JEdit.. not sure if that was the right way to enter my text.
public class Prime
{
private static boolean primeCounter(int number)
{
int counter = 0
for (int i = 2; i < number; i++)
{
if (number % i == 0)
return false;
else
return true;
if (false); //not sure how to count which prime number I am up to according to my user input of a positive integer
counter++;
}
}
// This is where I will enter my main method
public static void main(String[] args)
{
String userInput = JOptionPane.showInputDialog(null, "Please enter a positive Integer:");
int num = Integer.parseInt(userInput);
}