/* 9/11/2017
 Java follows regular order of operations that you are familiar 
 with.
 If two or more operators have same precedence, follow associativity.
 % modulus operator defined on integers only
 % never means PERCENT in a program 
 ( ) overrides all rules of precedence
 Discussed difference between integer division and floating pt
 division.
 Java API
*/
public class AdvancedExpression {
  
  public static void main(String[] args)   {
    
       int num1=20, num2=65, num3=17;
       double answer;
       
       answer = num1 * num2 + (num3 - 50) / 2;
       
       System.out.println("answer to expr is: " + answer);
       // condition to test if a number is even or odd
       System.out.println("num1 is being tested for even OR odd: ");
       System.out.println(num1%2);  // if 0 is printed, num1 is even
       int a=8, b=7, c=900;
       a=b=c;
       System.out.println("a=" + a + " b=" + b + " c=" +c);
       
       // writing expressions from algebraic expressions
       answer = (a-b)/3;
       answer = (-2*a*b)/16;
       // take average of a, b, and c
       double average;
       b=905;
       average = (a+b+c) / 3.0; // () are critical!
       System.out.println("average of a,b,c is: " + average);
       double half= 1/2.0;
       System.out.println("half is: " + half);  
       // method call to calculate a mathematical function
       answer = Math.pow(4.0, 2.0);
       System.out.println("answer of 4.0^2.0 is: " + answer); 
       //double area = Math.PI * radius * radius;
    }
}
