/* Write a generic Calculator class with two private fields to store two numbers and complete at least the methods below. Allow each of the numbers to be a different data type. Calculator< Integer, Double > calc = new Calculator< Integer, Double >( 2, 3.141596 ); System.out.println( calc.add() ); System.out.println( calc.multiply() ); Calculator< Double, Integer > calc2 = new Calculator< Double, Integer >( 2.71828, 7 ); System.out.println( calc2.add() ); System.out.println( calc2.multiply() ); Hint: Consider using the Number class, which is the parent class of Double, Integer, etc. Then, consider performing all math operations on double values (see the doubleValue() method). */ import java.util.Random; public class Calculator<T1 extends Number, T2 extends Number>{ private T1 num1; private T2 num2; public Calculator( T1 num1, T2 num2 ){ this.num1 = num1; this.num2 = num2; } public double add( ){ double sum = 0.0; sum = num1.doubleValue() + num2.doubleValue(); return sum; } public double multiply( ){ double product = 0.0; product = num1.doubleValue() * num2.doubleValue(); return product; } public static void main( String[] args ){ //Calculator< String, Random > crazyCcalc = new Calculator< String, Random >( "hello, world", new Random() ); Calculator< Integer, Double > calc = new Calculator< Integer, Double >( 2, 3.141596 ); System.out.println( calc.add() ); System.out.println( calc.multiply() ); Calculator< Double, Integer > calc2 = new Calculator< Double, Integer >( 2.71828, 7 ); System.out.println( calc2.add() ); System.out.println( calc2.multiply() ); } }