( a super prime is where d1d2d3, d1d2 and d1 are all primes ex: 797 is a super prime because 797, 79 , and 7 are all prime)

The program overall is to take a user inputted amount of times the program is supposed to run,

and then each run through take an integer input and output the closest superprime to that number. Part of the assignment is I HAVE to have the 2 boolean methods.

Sample run that was given for the assignment:

"Sample run:

Enter the number of experiments N = 3

1. Number = 4501

The nearest super prime to 4501 is 3797

2. Number = 785

The nearest super prime to 785 is 797

3. Number = 5200

The nearest super prime to 5200 is 5939 "

Anyway, after attempting this for hours, I could really use some help, I brought it down from ~25 errors to 5, and all 5 errors are in one line of code but I am not sure what to do from here. Any help at all is greatly appreciated. I hope my sloppy variable usage isn't too confusing...

import java.util.*; //import the scanner public class Superprime { public static void main(String[] args) { Scanner kb = new Scanner(System.in); //declare scanner variable int x,number,p; // declare other variables for #experiments and the number to be tested System.out.println("Enter the number of experiments you want to run:"); x = kb.nextInt(); int y,z; //variables for while loops int q=p; //initialize a second variable =p to run in a loop int r=p; // initialize a 3rd variable =p to run in a second loop // this is to run the experiment as many times as the user wants to for (number = 0; number <=x; number++) { //each run of the experiment will get an input value to be tested System.out.println("Enter the number you want to test."); g= kb.nextInt(); //boolean statements while (!(issuperprime(g))) y=g++; while (!(issuperprime(g))) z=g--; if ((g-z)>(y-g)) { System.out.println("Number = " + g); System.out.println("The closest super prime to " + g + " is " + y); } else if ((g-z)<(y-g)) { System.out.println("Number = " + g); System.out.println("The closest super prime to " + g + " is " + z); } else if ((g-z)==(y-g)) { System.out.println("Number = " + g); System.out.println("The closest super prime to " + g + " is both " + y + " and " + z); } else System.out.println("Error"); } //prime method public static boolean isprime(int p) { if (p%2==0) return false; for(int i=3;i*i<=p;i+=2) { if(p%i==0) return false; break; } return true; } } //Super prime method public static boolean issuperprime(int sp) { sp=g; while (sp>=10) { if (!(isprime(p))) { return false; break; } else if (isprime(p)) sp=sp/10; } return true; } }

The errors are all in line 55, which is my first boolean method to determine if a number is prime.

Superprime.java:59: illegal start of expression

public static boolean isprime(int p)

^

Superprime.java:59: illegal start of expression

public static boolean isprime(int p)

^

Superprime.java:59: ';' expected

public static boolean isprime(int p)

^

Superprime.java:59: '.class' expected

public static boolean isprime(int p)

^

Superprime.java:59: ';' expected

public static boolean isprime(int p)

^

Er, the title of the post was made when I had 6 errors elsewhere that were all class, interface, or enum expected errors. I forgot the change it, please disregard the title since it has nothing to do with the post....sorry!