static void Main(string[] args) { MathProxy proxy = new MathProxy(); Console.WriteLine("4 + 2 = {0}", proxy.Add(4, 2)); Console.WriteLine("4 - 2 = {0}", proxy.Sub(4, 2)); Console.WriteLine("4 * 2 = {0}", proxy.Mul(4, 2)); Console.WriteLine("4 / 2 = {0}", proxy.Div(4, 2)); Console.ReadKey(); }
static void Main() { MathProxy proxy = new MathProxy(); Console.WriteLine("10 + 2 = " + proxy.Add(4, 2)); Console.WriteLine("10 - 2 = " + proxy.Sub(4, 2)); Console.WriteLine("10 * 2 = " + proxy.Mul(4, 2)); Console.WriteLine("10 / 2 = " + proxy.Div(4, 2)); Console.ReadKey(); }
static void Main(string[] args) { // Create math proxy MathProxy proxy = new MathProxy(); // Do the math Console.WriteLine("4 + 2 = " + proxy.Add(4, 2)); Console.WriteLine("4 - 2 = " + proxy.Sub(4, 2)); Console.WriteLine("4 * 2 = " + proxy.Mul(4, 2)); Console.WriteLine("4 / 2 = " + proxy.Div(4, 2)); // Wait for user Console.ReadKey(); }
static void Main(string[] args) { //proxy Proxy proxy = new Proxy(); proxy.Request(); //Example as below MathProxy mathProxy = new MathProxy(); Console.WriteLine("4 + 2 = " + mathProxy.Add(4, 2)); Console.WriteLine("4 - 2 = " + mathProxy.Sub(4, 2)); Console.WriteLine("4 * 2 = " + mathProxy.Mul(4, 2)); Console.WriteLine("4 / 2 = " + mathProxy.Div(4, 2)); Console.ReadKey(); }
static void Main(string[] args) { MathProxy proxy = new MathProxy(); Console.WriteLine($"4 + 2 = {proxy.Add(4, 2)}"); Console.WriteLine($"4 - 2 = {proxy.Sub(4, 2)}"); Console.WriteLine($"4 * 2 = {proxy.Multiply(4, 2)}"); Console.WriteLine($"4 / 2 = {proxy.Divide(4, 2)}"); try { Console.WriteLine($"4 / 0 = {proxy.Divide(4, 0)}"); } catch (DivideByZeroException ex) { Console.WriteLine(ex.Message); } }
static void Main(string[] args) { MathProxy proxy = new MathProxy(); double addresult = proxy.Add(2, 3); Console.WriteLine(addresult); double subresult = proxy.Sub(2, 3); Console.WriteLine(subresult); double mulresult = proxy.Mul(2, 3); Console.WriteLine(mulresult); double devresult = proxy.Dev(2, 3); Console.WriteLine(devresult); Console.Read(); }
static void Main(string[] args) { // Create proxy and request a service Proxy proxy = new Proxy(); proxy.Request(); //x // Create math proxy MathProxy proxy2 = new MathProxy(); // Do the math Console.WriteLine("4 + 2 = " + proxy2.Add(4, 2)); Console.WriteLine("4 - 2 = " + proxy2.Sub(4, 2)); Console.WriteLine("4 * 2 = " + proxy2.Mul(4, 2)); Console.WriteLine("4 / 2 = " + proxy2.Div(4, 2)); Console.ReadKey(); }