Question: Java Programing: Predefined mathematical methods that are part of the class Math in the package java.lang include those below. method name description abs( m )
Java Programing:
Predefined mathematical methods that are part of the class Math in the package java.lang include those below.
| method name | description |
|
|
|
|
|
| abs( m ) | returns the absolute value of m |
|
| ceil( m ) | rounds m to the smallest integer not less than m |
|
| floor( m ) | rounds m to the largest integer not greater than m |
|
| max( m , n ) | returns the larger of m and n |
|
| min( m , n ) | returns the smaller of m and n |
|
| pow( m , n ) | returns m raised to the power n |
|
| round( m ) | returns a value which is the integer closest to m |
|
| sqrt( m ) | returns a value which is the square root of m |
|
Evaluate each of the following, which include Math predefined methods.
|
(1) _____ Math.abs( 6.0 ) (2) _____ Math.abs( - 6.0 )
(3) _____ Math.ceil( 10.25 ) (4) _____ Math.ceil( - 6.8 )
(5) _____ Math.floor( - 5.1 ) (6) _____ Math.floor( 7.9 )
(7) _____ Math.pow( 5 , 2 ) (8) _____ Math.pow( 2 , 5 )
(9) _____ Math.max( 1.5 , 2 ) (10) _____ Math. min( 3 , 0.5 )
(11) _____ Math.min( 2 , 1.5 ) (12) _____ Math. max( 0.5 , 3 )
(13) _____ Math.sqrt( 16.0 ) (14) _____ Math. round( 0.6 )
(15) _____ Math.ceil( Math.pow( 3 , 0.5 ) )
(16) _____ Math.floor( Math.pow( 1.5 , 2 ) )
(17) _____ Math.ceil( Math.floor( 3.5 ) )
(18) _____ Math.min( Math.max( 3.0 , 2 ), 2.5)
(19) _____ Math.max( Math.min( 2.0 , 3 ), 3.0)
(20) _____ Math.sqrt( Math.pow( 2.0 , 3 ) )
(21) _____ Math.pow( Math.sqrt( 9 ) , 2 ) )
(22) _____ Math.round( Math.max( 2.1 , 3.1 ) )
(23) _____ Math.abs( Math.abs( 8.0 ) )
(24) _____ Math.min( Math.abs( 1.5 , 2 ) )
(25) _____ Math.ceil( Math.pow( 1 , 0.5 ) )
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
