/*
 * Code4.java
 * Dan Armendariz
 * Computer Science 76
 * Building Mobile Applications
 *
 * Changing variable type through typecasting.
 *
 */

class Code4 {

	public static void main(String [] args) {

		int myInt = 123;
		double myDouble = 123.0;
		String myStr = "123";
		String txtStr = "Hello, World!";

		// Integer math, is there a problem?
		System.out.println("myInt/5: " + (myInt / 5));

		// modulus
		System.out.println("myInt%5: " + (myInt % 5));

		// Double math, that's better
		System.out.println("myDouble/5: " + (myDouble / 5));

		// Double math by type casting an int
		System.out.println("(double)myInt/5: "+( (double)myInt / 5));

		// Another type-caste by forcing double math
		System.out.println("myInt/5.0: "+(myInt / 5.0));

		// Attempt to convert a string to int
		//System.out.println("Converting myStr to int: "+ (int)myStr);
		
		// Convert a string to an int
		System.out.println("Converting myStr to int: "+Integer.parseInt(myStr));
			
		// Convert another string to an int
		//System.out.println("Converting txtStr to int: "+Integer.parseInt(txtStr));
	}

}