/** 9/17/2018
  * This program introduces the if statement
  */
import java.util.Scanner;

public class CelctoFaran 
{
/** This main method 
  */
 public static void main(String[] args) 
 {
   // using a boolean variable
   boolean on = false;
   if (!on)
     System.out.println("Device is off."); 
   
   double celcius;
   System.out.println("Enter a degrees in Celcius: ");
   Scanner sc = new Scanner(System.in);
   celcius = sc.nextDouble();
   // 9/5 celcius + 32
   double faran = 9/5.0*celcius + 32;  
   System.out.println("celcius: " + celcius + " faranheit: " + faran);
   // using a boolean expression
   if (celcius == 0) 
       System.out.println("It is exactly 0 degrees celcius.");
   if (faran <= 32) {
       System.out.println("It is freezing!");
       System.out.println("Wear a winter coat.");
   }
   if (faran > 40 && faran < 55) 
       System.out.println("You may want to take a light jacket.");
   
   if (faran >=85) {
       System.out.println("It is very hot.");
   }
   // some more examples of expressions with logical operators
   // check whether grade is between 0 and 100
   int grade = 2;
   if (!(grade>=0 && grade<=100))
       System.out.println("not a valid grade");
   if (grade < 0 || grade>100) 
       System.out.println("not a valid grade");
  
   int num=51;
   if (num-10 < grade+9 || num > grade) // how is this parsed?
     // using rules of precedence: mathematical, relational, logical
       System.out.println("...");
   
   // how do i check if a number is divisible by 2?
   if (num % 2 == 0)
       System.out.println("num is even");
   else // otherwise, same as checking:  if (num % 2 != 0)
       System.out.println("num is odd");
   
   if (num % 2 == 0 && num % 5 == 0)
       System.out.println("num is even AND it is divisible by 5.");
   
   int num1=60, num2=7;
   int max, min;
   if (num1 > num2) {
     // int max, min; // block scope
     max = num1;
     min = num2;
   }
   else {
     max = num2;
     min = num1;
   }
   System.out.println("max of the 2 numbers is: " + max);
   
   
   
   
 }
}
