I have the following program compiling and running. However, the program is supposed to print out stars equal to the user input, with each star representing 10. If the user inputs 100 the program should print out 10 stars. No matter what number I input the program is printing out 1 star. Can someone give me a clue as to what I am doing wrong??
import java.util.Scanner;
import java.io.*;
import java.math.*;
import java.util.*;
public class GrowthofaFunction
{
//Method to calculate function
public static int calculateFunction(int x)
{
int result = 0;
final int X;
final int y1;
final int y2;
final int y;
System.out.print("Enter value for x: ");
Scanner stdin = new Scanner(System.in);
x = stdin.nextInt();
y1= x+ (x*x);
y2 = (int) (Math.pow(2,x));
y = y1 + y2;
return y;
}
//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("*");
}
}