Outprintlnmathsqrtb b a

This preview shows page 3 - 6 out of 9 pages.

); c ); ); );
Image of page 3
System. out .println(( double ) d / c ); //division operator used //because one of the vaules in the expression is of type double (even if it's being cated ), //the result is of type double //Yields: 3.4 System. out .println( d % b ); //modulus operator returns the remainder of d mod b // Yields: 1 System. out .println( d / b ); //integer division will occur only the whole nukmber of the quotient will be returned // Yield: 4 System. out .println( ( double ) d / b ); //because a double is in th eexpression // the whole expression was upgraded to a floating point type double // Yields: 4.25 System. out .println( d + a / d + b ); //PEMDAS (oder of operations) // a/d // a/d + b // ( a/d + b )+ 4 // yields: 21 System. out .println(( d + a ) / ( d + b )); //d+a =x //d+b =y // x/y //yields: 0 System. out .println(Math. sqrt ( b )); // sqrt (4) = 2.0 System. out .println(Math. pow ( a , b )); //uses power method // 3^4 // Yields: 81.0 System. out .println(Math. abs (- a )); // abs value // abs (-3) = 3 System. out .println(Math. max ( a , b )); //max method: finds the maximum value // Yields 4
Image of page 4
} }
Image of page 5
Image of page 6

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture