/* * @topic T10180 Feb 7, 2017 Inheritance Demo * @brief main driver program */ package week03; public class MainApp { public static void main(String[] args) { ProgrammableAppliance app = new ProgrammableAppliance(); app.addOperation( new BinaryOp( 10, 20, BinaryOp.ADD ) ); app.addOperation( new MultiplyOp( 1, 5 ) ); app.addOperation( new BinaryOp( 10, 20, BinaryOp.SUBTRACT ) ); app.compute(); int result = app.getResult(); System.out.println( "Result: " + result ); /* BinaryOp op = new BinaryOp( 10, 20, BinaryOp.ADD ); op.compute(); int result = op.getResult(); System.out.println( "Add Result: " + result ); MultiplyOp op2 = new MultiplyOp( result, 5 ); op2.compute(); result = op2.getResult(); System.out.println( "Multiply Result: " + result ); */ }//main }//class MainApp