
import static java.lang.System.*;

public class HelpMath 
{
  public static void main(String[] args) 
  {
       
  out.println("The Math Class");
  out.println();
  out.println();
  
  /*
  out.println("Math Methods");
  out.println();
  out.println("abs()     returns the absolute value of a given number");
  out.println("sqrt()    returns the square root of a given number as a double");
  out.println("min()     returns the smaller of two given numbers");
  out.println("max()     returns the larger of two given numbers");
  out.println("floor()   returns the given number rounded down");
  out.println("ceil()    returns the given number rounded up");
  out.println("round()   returns the given number rounded to the closest int");
  out.println();
  out.println();
  */
  
  out.println("Math.abs(?)");
  out.println("==============");
  out.println("Math.abs(24) is " + Math.abs(24));   
  out.println("Math.abs(-24) is " + Math.abs(-24));   
  out.println("Math.abs(7) is " + Math.abs(7));  
  out.println("Math.abs(-7) is " + Math.abs(-7));  
  out.println("Math.abs(-7.4) is " + Math.abs(-7.4));  
  out.println("Math.abs(-7.5) is " + Math.abs(-7.5));    
  out.println("Math.abs(-7.7) is " + Math.abs(-7.7));  
  out.println();
    
  
  out.println("Math.sqrt(?)");
  out.println("==============");
  out.println("Math.sqrt(0) is " + Math.sqrt(0));   
  out.println("Math.sqrt(9) is " + Math.sqrt(9));   
  out.println("Math.sqrt(12) is " + Math.sqrt(12));   
  out.println("Math.sqrt(16) is " + Math.sqrt(16));   
  out.println("Math.sqrt(20) is " + Math.sqrt(20));   
  out.println("Math.sqrt(25) is " + Math.sqrt(25));   
  out.println();

  out.println("Math.min(?, ?)  (returns the smaller number)");
  out.println("==============");
  out.println("Math.min(2, 3) is " + Math.min(2,3));   
  out.println("Math.min(-3, 8) is " + Math.min(-3, 8));   
  out.println("Math.min(13, 7) is " + Math.min(13, 7));   
  out.println("Math.min(1.2, 2) is " + Math.min(1.2, 2));   
  out.println("Math.min(20, 3.14) is " + Math.min(20, 3.14));   
  out.println("Math.min(25, 27.7) is " + Math.min(25, 27.5));   
  out.println();
  
  out.println("Math.max(?, ?)  (returns the larger number)");
  out.println("==============");
  out.println("Math.max(2, 3) is " + Math.max(2,3));   
  out.println("Math.max(-3, 8) is " + Math.max(-3, 8));   
  out.println("Math.max(13, 7) is " + Math.max(13, 7));   
  out.println("Math.max(1.2, 2) is " + Math.max(1.2, 2));   
  out.println("Math.max(20, 3.14) is " + Math.max(20, 3.14));   
  out.println("Math.max(25, 27.5) is " + Math.max(25, 27.5));   
  out.println();
  
  out.println("Math.floor(?)  (rounds down)");
  out.println("==============");
  out.println("Math.floor(2) is " + Math.floor(2));   
  out.println("Math.floor(-3.8) is " + Math.floor(-3.8));   
  out.println("Math.floor(-3.5) is " + Math.floor(-3.5));   
  out.println("Math.floor(13.7) is " + Math.floor(13.7));   
  out.println("Math.floor(1.2) is " + Math.floor(1.2));   
  out.println("Math.floor(3.001) is " + Math.floor(3.001));   
  out.println("Math.floor(27.5) is " + Math.floor(27.5));   
  out.println();
  
  out.println("Math.ceil(?)  (rounds up)");
  out.println("==============");
  out.println("Math.ceil(2) is " + Math.ceil(2));   
  out.println("Math.ceil(-3.8) is " + Math.ceil(-3.8));   
  out.println("Math.ceil(-3.5) is " + Math.ceil(-3.5));   
  out.println("Math.ceil(13.7) is " + Math.ceil(13.7));   
  out.println("Math.ceil(1.2) is " + Math.ceil(1.2));   
  out.println("Math.ceil(3.001) is " + Math.ceil(3.001));   
  out.println("Math.ceil(27.5) is " + Math.ceil(27.5));   
  out.println();
  
  out.println("Math.round(?)  (rounds to nearest int)");
  out.println("==============");
  out.println("Math.round(2) is " + Math.round(2));   
  out.println("Math.round(-3.8) is " + Math.round(-3.8));   
  out.println("Math.round(-3.5) is " + Math.round(-3.5));   
  out.println("Math.round(13.7) is " + Math.round(13.7));   
  out.println("Math.round(1.2) is " + Math.round(1.2));   
  out.println("Math.round(3.001) is " + Math.round(3.001));   
  out.println("Math.round(27.5) is " + Math.round(27.5));   
  out.println();
  
  out.println("Math.pow(?, ?)  (raises to a power)");
  out.println("==============");
  out.println("Math.pow(2, 3) is " + Math.pow(2, 3));   
  out.println("Math.pow(2, 4) is " + Math.pow(2, 4));   
  out.println("Math.pow(2, 5) is " + Math.pow(2, 5));   
  out.println("Math.pow(10, 2) is " + Math.pow(10, 2));   
  out.println("Math.pow(2.2, 3) is " + Math.pow(2.2, 3));   
  out.println();
  
  out.println("Math.random()  (returns random number 0.0 to 0.999999999999999)");
  out.println("==============");
  out.println("Math.random() is 0.0 to 0.999999999999999 " + Math.random());   
  // out.println("int(Math.random()+6) is " + (int) ( Math.random() + 6) );   
  
  out.println("int(Math.random()*6) is (0 to 5) " + (int) ( Math.random() * 6) );   
  out.println("int(Math.random()*6) is (0 to 5) " + (int) ( Math.random() * 6) );   
  out.println("int(Math.random()*6) is (0 to 5) " + (int) ( Math.random() * 6) );   
  out.println("int(Math.random()*6) is (0 to 5) " + (int) ( Math.random() * 6) );   
  out.println("int(Math.random()*5) is (0 to 4) " + (int) ( Math.random() * 5) );   
  out.println("int(Math.random()*4) is (0 to 3) " + (int) ( Math.random() * 4) );   
  out.println("int(Math.random()*3) is (0 to 2) " + (int) ( Math.random() * 3) );   
  out.println("int(Math.random()*2) is (0 to 1) " + (int) ( Math.random() * 2) );   
  out.println("int(Math.random()*1) is (0 to 0) " + (int) ( Math.random() * 1) );   

  out.println();

  
  
  } // end of main method
  
} // end of class HelpMath

/*
The Math Class


Math.abs(?)
==============
Math.abs(24) is 24
Math.abs(-24) is 24
Math.abs(7) is 7
Math.abs(-7) is 7
Math.abs(-7.4) is 7.4
Math.abs(-7.5) is 7.5
Math.abs(-7.7) is 7.7

Math.sqrt(?)
==============
Math.sqrt(0) is 0.0
Math.sqrt(9) is 3.0
Math.sqrt(12) is 3.4641016151377544
Math.sqrt(16) is 4.0
Math.sqrt(20) is 4.47213595499958
Math.sqrt(25) is 5.0

Math.min(?, ?)  (returns the smaller number)
==============
Math.min(2, 3) is 2
Math.min(-3, 8) is -3
Math.min(13, 7) is 7
Math.min(1.2, 2) is 1.2
Math.min(20, 3.14) is 3.14
Math.min(25, 27.7) is 25.0

Math.max(?, ?)  (returns the larger number)
==============
Math.max(2, 3) is 3
Math.max(-3, 8) is 8
Math.max(13, 7) is 13
Math.max(1.2, 2) is 2.0
Math.max(20, 3.14) is 20.0
Math.max(25, 27.5) is 27.5

Math.floor(?)  (rounds down)
==============
Math.floor(2) is 2.0
Math.floor(-3.8) is -4.0
Math.floor(-3.5) is -4.0
Math.floor(13.7) is 13.0
Math.floor(1.2) is 1.0
Math.floor(3.001) is 3.0
Math.floor(27.5) is 27.0

Math.ceil(?)  (rounds up)
==============
Math.ceil(2) is 2.0
Math.ceil(-3.8) is -3.0
Math.ceil(-3.5) is -3.0
Math.ceil(13.7) is 14.0
Math.ceil(1.2) is 2.0
Math.ceil(3.001) is 4.0
Math.ceil(27.5) is 28.0

Math.round(?)  (rounds to nearest int)
==============
Math.round(2) is 2
Math.round(-3.8) is -4
Math.round(-3.5) is -3
Math.round(13.7) is 14
Math.round(1.2) is 1
Math.round(3.001) is 3
Math.round(27.5) is 28

Math.pow(?, ?)  (raises to a power)
==============
Math.pow(2, 3) is 8.0
Math.pow(2, 4) is 16.0
Math.pow(2, 5) is 32.0
Math.pow(10, 2) is 100.0
Math.pow(2.2, 3) is 10.648000000000003

Math.random()  (returns random number 0.0 to 0.999999999999999)
==============
Math.random() is 0.0 to 0.999999999999999 0.6511022724186535
int(Math.random()*6) is (0 to 5) 5
int(Math.random()*6) is (0 to 5) 2
int(Math.random()*6) is (0 to 5) 5
int(Math.random()*6) is (0 to 5) 0
int(Math.random()*5) is (0 to 4) 3
int(Math.random()*4) is (0 to 3) 2
int(Math.random()*3) is (0 to 2) 1
int(Math.random()*2) is (0 to 1) 0
int(Math.random()*1) is (0 to 0) 0
*/


