Fri Feb 05, 2010 1:23 am
public class ProjectOneTwo
{
public static void main(String[] args)
{
double a = Double.parseDouble(args[0]);
double b = Double.parseDouble(args[1]);
int n = Integer.parseInt(args[2]);
System.out.println(" "+args[0]+" "+args[1]+" "+args[2]);
double dx = (b-a)/n;
double x, sf, y;
double max;
double min;
double nSpaces;
int i = 0;
x= a + i * dx;
y= x*x*x;
max=y;
min=y;
for(i=0; i<=n; i++)
{
x= a + i * dx;
y= x*x*x;
if(y>max)
{
max=y;
}
else if(y<min)
{
min=y;
}
}
sf = 120/(max - min);
System.out.println(dx);
System.out.println(max);
System.out.println(min);
for(i=0; i>n; i++)
{
x = a + i * dx;
y = x*x*x;
nSpaces = (int) ((y - min) * sf);
/**************
i think this is where things go wrong
**************/
int j = 0;
if(j<nSpaces)
{
System.out.print(" ");
}
else if(j>=nSpaces)
{
System.out.println("*");
}
}
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.