This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: + toString(): String - op1: double - op2: double Subtract + Subtract(op1: double, op2: double) + result(): double + toString(): String - op1: double - op2: double King Saud University College of Computer and Information Systems, Department of Computer Science CSC 113: Java Programming-II, Spring2011 Tutorial #5 : Inheritance You have to do the following: 1. Implement the above classes 2. Write a main class, in it: a. Define an array of MathOp with the size 3. b. Add these three operations to it : 5 + 3 , 2 – 1 , 10.5 + 5 using Add and Subtract . c. Loop through the 3 operaƟons in the array and print the string representaƟon of the operation and the result of each operation using the methods toString() and result() . You should get an output similar to this: 5 + 3 = 8 2 – 1 = 1 10.5 + 5 = 15.5...
View Full Document