import java.util.Scanner;


class Sep13 {
	public static void main(String[] args) {

		Scanner kb = new Scanner(System.in);

		/*
		 * Lets read in some data that we can use in the Boolean expressions below.
		 * Remember, Boolean expressions are expressions that are either true or false.
		 */

		System.out.println("enter a character");
		String input = kb.next();
		char initial = input.charAt(0);

		System.out.println("enter an integer");
		int num = kb.nextInt();

		System.out.println("enter true or false");
		boolean flag = kb.nextBoolean();

		System.out.println("enter a string");
		String text = kb.next();

		/*
		 * conditional required syntax
		 
		 	if (boolean_expression) {
				// code
			}

		 */

		/*
		 * else if and else blocks are optional
		 */

		if (initial == 'A') {
			System.out.println("intial is A");
		}

		/*
		 * == is the comparson operator for all primitive types.
		 *
		 * When used, both operands have to have the same type.
		 * You can't compare apples and oranges.
		 */

		if (num == 10) {
			System.out.println("number is 10");
		}	

		if (flag == false) {
			System.out.println("flag is false");
		}
		
		/*
		 * != is the not equal comparison operator for primitive types.
		 */

		if (num != 10) {
			System.out.println("num is not equal to 10");
		}

		/*
		 * To compare Strings we cannot use ==.  We must use the String's 
		 * .equals method.
		 */

		if (text.equals("hello")) {
			System.out.println("text is hello");
		}


		/***********************
		 * Relational Operators
		 
			<
		 	<=
		 	>
		 	>=

		 **********************/


		/********************
		 * Logical Operators 
		 ********************/

		/*
		 * Boolean expression with a logical OR
		 */

		if (initial == 'E' || initial == 'e') {
			System.out.println("E or e");
		}

		/*
		 * Boolean expression with a logical AND
		 */

		if ((num % 2 == 0) && num > 10) {
			System.out.println("num is an even number greater than 10");
		}

		/*
		 * Boolean expression with a logical NOT
		 */

		if (!(num == 10)) {
			System.out.println("num is not 10");
		}

		if (!text.equals("hello")) {
			System.out.println("text is not hello");
		}

		/*
		 * A compound Boolean expression can have multiple logical operators
		 */

		if (initial == 'E' && (num < 10 || !(num % 2 == 0))) {
			System.out.println("initial is E and either num is less than 10 or num is odd");
		}

		/********************************
		 * Nested Conditional Statements 
		 ********************************/

		if (num < 10) {
			if (num == 0) {
				System.out.println("num is zero");
			}
			else {
				System.out.println("num is less than 10, but not zero");
			}
		}

		/*************
		 * ?: operator
		 *************/
		
		/*
		 * Common pattern where a variable is set to two different values
		 * based on value of boolean expression.
		 */

		char symbol = 'x';
		if (num % 2 == 0) {
			symbol = 'o';
		}
		else {
			symbol = 'x';
		}

		/*
		 * Statement below is equivalent to the above 7 lines of code
		 */

		char symbol2 = (num % 2 == 0) ? 'o' : 'x';

	}
}
