View Single Post
Displaying data in table with java?
(#1 (permalink))
Old
iverson_575 is Offline
Private
Points: 196, Level: 2 Points: 196, Level: 2 Points: 196, Level: 2
Activity: 0% Activity: 0% Activity: 0%
iverson_575 is an unknown quantity at this point
 
 
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Dec 2007
Displaying data in table with java? - December 13th, 2007

I am developing a program where the user enters a starting integer and an ending integer then in a table I print the staring integer to the ending integer sqrt(), cbrt(), exp().
Should look something like this:

say i enter 1 and 5

Square root: 1 2 4 5
Cube root: 6 8 9 0
exp: 7 8 9 0


doubles have to be formated to 2 decimal places. Heres what I have so far. I just don't know how to show Sqare Root, Cube Root, and exp only once with out repeating witht the number the user entered.

while(s <= e)
{
System.out.print("Squre Root "+form.format(Math.sqrt(s)));
System.out.print("Cube Root "+form.format(Math.cbrt(s)));
System.out.print("Exp "+form.format(Math.exp(s)));
s++;
}

I end up getting something like this:

Square Root: 1.00 Square Root 1.41 Square Root 1.73
Cube Root: 3.00 Cube Root 6.34 Cube Root 4.56
Exp: 4.32 Exp: 2.34 Exp: 1.23

Revenue Shared Ads