package javaIntro;

import java.awt.Rectangle;

public class Simple {

	public static void main(String[] args) {
		int x = 1;
		int y = 3;
		int z = 5;
		z = (x + y) * z / 17;

		System.out.println(z);

		// compare
		System.out.println((1 + 3) * 5.0 / 17);

		double hypotenuse = 5;
		double angle = Math.PI/4.0;
		double opposite;
		opposite = hypotenuse * Math.sin(angle);
		System.out.println(opposite);

		// compare

		System.out.println(5/Math.sqrt(2));
		String title = "Mississippi".substring(0,4);
		System.out.println(title);

		Rectangle rectang = new Rectangle(12,20,15,17);
		System.out.println(rectang);

		rectang.translate(20, 35);
		System.out.println(rectang);

		//Java does not care about the end of line or indentation:

		double z1 = (x +
		y
			   )
	*
	5
				 /  17
				 ;

			System.out.println(z1);

			String title1 = "Mississippi"
					.substring(4
							,6);

			String title2 = "Mississippi"
					.
					substring(6
							,9
							)
							;

			System.out.println(
					title1
					);
		System.out.println(title2);
		// The double-quotes around a String literal must begin and end
		// on the same line
		String str = "This is a long String spread over several "
				+ "lines but it must be broken down into several "
				+ "shorter Strings that are each on a single line. "
				+ "The plus sign \"+\" is used to concatenate "
				+ "these shorter String literals together. "
				+ "We use the term 'literal' for things that "
				+ "represent their own value in the source code";

		System.out.println(str);

	}
}