import java.io.*;
import java.math.*;
import java.util.*;


public class GrowthofaFunction 
{

	public int calculateFunction(int x) {
		return 0;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{
		
		public void calculateFunction();
		{
			
			final int x;
			final int y1;
			final int y2;
			final int y;
			
			Scanner stdin = new Scanner(System.in);
			
			System.out.print("Enter value for x: ");
			x = stdin.nextInt();
			
			y1 = x + (x*x);
			y2 =(int) (Math.pow(2,x));
			y = y1 + y2;
			return y;
			
			
             //	printStars has input x
			
			for (int i = 0; i <= 0; i++)
			   {
				   y = stdin.nextInt();
				   i = y/10;
			   }
			      System.out.print("*");
			      return y;
		}	 
			      
	}	
}

There is something wrong with my code and I still can't figure it out. Can someone tell me? I am just suppose to calculate an function and printStars.

Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 528
(([-+]?(((((?i)[]|\p{javaDigit})++)|([\p{javaDigit}&&[^0]]((?i)[]|\p{javaDigit})?((?i)[]|\p{javaDigit})?(\,((?i)[]|\p{javaDigit})((?i)[]|\p{javaDigit})((?i)[]|\p{javaDigit}))+)))))|(((((?i)[]|\p{javaDigit})++)|([\p{javaDigit}&&[^0]]((?i)[]|\p{javaDigit})?((?i)[]|\p{javaDigit})?(\,((?i)[]|\p{javaDigit})((?i)[]|\p{javaDigit})((?i)[]|\p{javaDigit}))+)))|(\Q-\E((((?i)[]|\p{javaDigit})++)|([\p{javaDigit}&&[^0]]((?i)[]|\p{javaDigit})?((?i)[]|\p{javaDigit})?(\,((?i)[]|\p{javaDigit})((?i)[]|\p{javaDigit})((?i)[]|\p{javaDigit}))+)))
^
at java.util.regex.Pattern.error(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.group0(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.group0(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.group0(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.group0(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.group0(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.group0(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.<init>(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.Scanner$1.create(Unknown Source)
at java.util.Scanner$1.create(Unknown Source)
at sun.misc.LRUCache.forName(Unknown Source)
at java.util.Scanner.integerPattern(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at GrowthofaFunction.main(GrowthofaFunction.java:29)

THAT IS MY ERROR

import java.util.Scanner;


public class GrowthofaFunction 
{
	//Method to calculate function
	public static int calculateFunction(int x) 
	{	
		int result = 0;
		
		System.out.print("Enter value for x: ");
		
		Scanner stdin = new Scanner(System.in);
		x = stdin.nextInt();
		result= (x + (x*x) + (int)(Math.pow(2,x)));
		return result;
	}
	
	//Method to printStars
	public static void printStars(int numberofStars)
	{
		for (int i = 0; i <= numberofStars; i++)
		   {
			for (int j = 0; j >=1; j++)
			{
			  int x = 0;
			  numberofStars = (calculateFunction(x)/10);
			  System.out.print("*");
			}
		   }
    }



	public static void main(String[] args) 
	{
		int x = 0;
		int numberofStars = 0;

		calculateFunction(x);
		
		printStars(numberofStars);
		System.out.println(" ");



			      
	}
		
}

Ok the only problem now is the stars will not print. :(

Take a look at your loop:

for (int j = 0; j >=1; j++)

Your condition:

j>=1

This is the same as saying "loop while that j is greater than, or equal to 1. You start your counter j=0 which means j is zero (not greater than 1). It never executes the loop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.