/* vi command :#
 * Arithmetic
    - variable names - writing for future developers
    - variable scope
	- integer vs. floating-point division
	- addition, ++, +=
	- subtraction, --, -=
	- modulo arithmetic
    - printf()
*/

import java.util.Scanner;

class Sep7 {
	public static void main(String[] args) {
		
		int shoeSize = 10;
		int cost = 0;

		// comparing the value in shoeSize with the value 10
		if (shoeSize == 10){
			cost = 100;
		}
		System.out.println("Cost: " + cost);

		// Some simple arithmetic
		int x = 10;
		int y = 5;
		
		int z = x + y;
		int w = x * y;

		// When both operands are integers, division rounds down.
		// This is called integer division.
		w = 10 / 3;
		System.out.println(w);

		// When at least one of the operands is a floating-point value, 
		// then division creates a floating-point value.
		double t = 10 / 3.0;
		//System.out.println(t);	

		// incrementing an integer, i.e. adding to the value of an integer
		System.out.println(x);
		x = x + 1;
		System.out.println(x);
		x++;				// syntactic sugar
		System.out.println(x);

		// incrementing an integer, i.e. adding to the value of an integer
		x = x - 1;
		System.out.println(x);
		x--;				// more sugar
		System.out.println(x);

		x = x * 2;
		System.out.println(x);
		x*=2;				// even more sugar
		System.out.println(x);

		// The modulus operator (%) computes the remainder after the division
		// of the first operand by the second operand
		x = 15 % 12;
		System.out.println(x);
			
		x = 5 % 2;  // When 5 is divided by 2 the remainder is 1, thus x will be 1
		x = 6 % 2;  // When 6 is divided by 2 the remainder is 0, thus x will be 0

		Scanner kb = new Scanner(System.in);
		System.out.println("Please enter an integer");
		int input = kb.nextInt();
		
		if(input % 2 == 0) {
			System.out.println(input + " is even");

			// using printf below to do the same as the above
			// %d is a placeholder that is replaced by the value in input
			// \n is the newline character
			System.out.printf("%d is even, %d\n", input);
		}
		else {
			System.out.printf("%d is odd\n", input);
		}

	

	}
}
