My program will just print out value. I just don't know what to put in for where the value is. If anyone could help me that'd be great.
Please enter a number: 3.14159
Math.ceil(3.142) = 4.000
Math.abs(3.142) = 3.142
Math.floor(3.142) = 3.000
Math.log(3.142) = 1.145
Math.pow(3.142,3.142) = 36.462
Math.sqrt(3.142) = 1.772
public class acscott_Math
{
public static void main ( String args[] )
{
double value;
Scanner input = new Scanner ( System.in );
System.out.print( "\nPlease enter a number: " );
value = input.nextDouble();
System.out.print( "\n" );
System.out.printf( "Math.ceil(value) = %.3f\n", Math.ceil(value));
System.out.printf( "Math.abs(value) = %.3f\n", Math.abs(value));
System.out.printf( "Math.floor(value) = %.3f\n", Math.floor(value));
System.out.printf( "Math.log(value) = %.3f\n", Math.log(value));
System.out.printf( "Math.pow(value) = %.3f\n", Math.pow(value, value));
System.out.printf( "Math.sqrt(value) = %.3f\n", Math.sqrt(value));
}
}

New Topic/Question
Reply



MultiQuote



|