//DoubleDemo.java //Application that hardcodes 2 numbers, outputs their sum, product etc. public class DoubleDemo { public static void main (String[] args) { //double for real number value (can have .) double num1; double num2; double sum, difference, product, quotient, remainder; //Use int for counting, double for measuring. num1 = 12.5; num2 = 5.3; sum = num1 + num2; difference = num1 - num2; product = num1 * num2; //if one or both of numerator or denominator is double, does real division: quotient = num1 / num2; //real division by zero results in "infinity" remainder = num1 % num2; System.out.println("Sum is " + sum + "\nDifference is " + difference + "\nProduct is " + product + "\nQuotient is " + quotient + "\nRemainder is " + remainder); } } /* 12 OK divide by zero == infinity, not exception. doubleVar = intValue OK intVar = doubleValue syntax error integers for counting real numbers for measuring CPU: separate circuitry for integer vs real arithmetic */