Saturday, February 28, 2015

pentagonal program


I have to write a program that displays the first 100 pentagonal numbers using different methods. This is what I have so far:


public class FivePointOne{

public static void main(String[]args){

System.out.println("The the pentagonal numbers are: ");

}

//this method will find the penagonal numbers

public static int getPentagonalNumber(int n){

for(int i = 0; i < 100 ; i++){

if(valueOfEquation(i) % 5 == 0)


}

//return n;

}

//This method will calculate the numerator

public static int getNumerator(int n){

int N = (n*((3*n)-1));

return N;

}

//This method defines the denominator

public static int getDenominator(int n){

final int d = 2;

return d;

}

//This method will calcualte the equation

public static int valueOfEquation(int n){

int value = getNumerator(N) / getDenominator(d) ;

return value;

}


}


But when I compile it to test it out I receive the error message "Illegal start of expression," ';' expected, and "reach end of file while parsing". Can anyone explain to me what is going on and how to fix it so?



No comments:

Post a Comment