Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2016
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 KB | None | 0 0
  1. namespace CalculatorApp
  2. {
  3.     public interface ICalculator
  4.     {
  5.         int Add(int firstValue, int secondValue);
  6.         int Subtract(int firstValue, int secondValue);
  7.         int Multiply(int firstValue, int secondValue);
  8.         int Divide(int firstValue, int secondValue);
  9.     }
  10.  
  11.     public abstract class BaseCalculator : ICalculator
  12.     {
  13.         public virtual int Add(int firstValue, int secondValue)
  14.         {
  15.             return firstValue + secondValue;
  16.         }
  17.  
  18.         public virtual int Subtract(int firstValue, int secondValue)
  19.         {
  20.             return firstValue - secondValue;
  21.         }
  22.  
  23.         public virtual int Multiply(int firstValue, int secondValue)
  24.         {
  25.             return firstValue * secondValue;
  26.         }
  27.  
  28.         public virtual int Divide(int firstValue, int secondValue)
  29.         {
  30.             return firstValue / secondValue;
  31.         }
  32.     }
  33.  
  34.     public class CalculatorAgent : BaseCalculator
  35.     {
  36.         public override int Add(int firstValue, int secondValue)
  37.         {
  38.             return base.Add(firstValue, secondValue);
  39.         }
  40.  
  41.         public override int Subtract(int firstValue, int secondValue)
  42.         {
  43.             return base.Subtract(firstValue, secondValue);
  44.         }
  45.  
  46.         public override int Multiply(int firstValue, int secondValue)
  47.         {
  48.             return base.Multiply(firstValue, secondValue);
  49.         }
  50.  
  51.         public override int Divide(int firstValue, int secondValue)
  52.         {
  53.             return base.Divide(firstValue, secondValue);
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement