public static void Main()
Calculator myCalc = new Calculator();
Console.WriteLine ("Add:" + myCalc.Add(1,2) + " " + myCalc.Add(1,2).GetType());
Console.WriteLine ("Subtract:" + myCalc.Subtract(1,2)+ " " + myCalc.Subtract(1,2).GetType());
Console.WriteLine ("Multiply:" + myCalc.Multiply(1,2)+ " " + myCalc.Multiply(1,2).GetType());
Console.WriteLine ("Divide:" + myCalc.Divide(1,2)+ " " + myCalc.Divide(1,2).GetType());
Console.WriteLine ("////////////////////////string//////////////////////////////////");
StringCalculator myStrCalc = new StringCalculator();
Console.WriteLine ("Add:" + myStrCalc.Add(1,2) + " " + myStrCalc.Add(1,2).GetType());
Console.WriteLine ("Subtract:" + myStrCalc.Subtract(1,2)+ " " + myStrCalc.Subtract(1,2).GetType());
Console.WriteLine ("Multiply:" + myStrCalc.Multiply(1,2)+ " " + myStrCalc.Multiply(1,2).GetType());
Console.WriteLine ("Divide:" + myStrCalc.Divide(1,2)+ " " + myStrCalc.Divide(1,2).GetType());
Console.WriteLine ("////////////////////////Tedans//////////////////////////////////");
TedansCalc tedansCalc = new TedansCalc();
Console.WriteLine ("Add:" + tedansCalc.Add(typeof(double),1,2) + " " + tedansCalc.Add(typeof(double),1,2).GetType());
Console.WriteLine ("Subtract:" + tedansCalc.Subtract(typeof(string),1,2) + " " + tedansCalc.Subtract(typeof(string),1,2).GetType());
Console.WriteLine ("Multiply:" + tedansCalc.Multiply(typeof(string),1,2) + " " + tedansCalc.Multiply(typeof(string),1,2).GetType());
Console.WriteLine ("Divide:" + tedansCalc.Divide(typeof(string),1,2) + " " + tedansCalc.Divide(typeof(string),1,2).GetType());
Console.WriteLine ("////////////////////////Johns//////////////////////////////////");
JohnsCalc johnscalc = new JohnsCalc();
johnscalc.Add(ref s, ref d,1,2);
Console.WriteLine (s + " " + d);
public static double Add(double x, double y)
public double Add(double x, double y)
public double Subtract(double x, double y)
public double Divide(double x, double y)
public double Multiply(double x, double y)
public class StringCalculator
Calculator myCalc = new Calculator();
public string Add(double x, double y)
return myCalc.Add(x,y).ToString();
public string Subtract(double x, double y)
return myCalc.Subtract(x,y).ToString();
public string Divide(double x, double y)
return myCalc.Divide(x,y).ToString();
public string Multiply(double x, double y)
return myCalc.Multiply(x,y).ToString();
public object Add(System.Type type, double x, double y)
if (type == typeof(string))
else if (type == typeof(double))
public object Subtract(Type type, double x, double y)
if (type == typeof(string))
else if (type == typeof(double))
public object Divide(Type type, double x, double y)
if (type == typeof(string))
else if (type == typeof(double))
public object Multiply(Type type, double x, double y)
if (type == typeof(string))
else if (type == typeof(double))
public void Add(ref String s, ref Double d, Double x, Double y)