title: To create a class called Calculator which contains methods for arithmetic operations
body: <p>The question is 
  Create a class called Calculator which contains methods for arithmetic operations such as Addition, Subtraction ,Multiplication and Division. Division method should return the Quotient and Remainder(hint:use out parameter).</p>
  
  <p>Follow the method signatures as given below:</p>
  
  <p>public int Addition(int a, int b)</p>
  
  <p>public int Subtraction(int a, int b)</p>
  
  <p>public int Multiplication(int a, int b)</p>
  
  <p>public double Division(int a, int b, out double remainder).  //The method should  return the Quotient and Remainder  should be  passed through the out parameter.</p>
  
  <p>The methods should return the appropriate result.</p>
  
  <p>Create a class Program with Main Method . Prompt for 2 operands and operator from the user, Call the appropriate method for operation and display the results.</p>
  
  <p>Note:</p>
  
  <p>Don't create any new namespace.</p>
  
  <p>Create classes with pubic access specifier</p>
  
  <p>Sample Input</p>
  
  <p>Enter the operator</p>
  
  <p>+</p>
  
  <p>Enter the operands</p>
  
  <p>12</p>
  
  <p>10</p>
  
  <p>Sample Output</p>
  
  <p>Result of 12 + 10 is 22</p>
  
  <p>Sample Input</p>
  
  <p>Enter the operator</p>
  
  <p>/</p>
  
  <p>Enter the operands</p>
  
  <p>11</p>
  
  <p>2</p>
  
  <p>Sample Output</p>
  
  <p>Result of 11 / 2 is 5</p>
  
  <p>Remainder =1</p>
  
  <p>Sample Input</p>
  
  <p>Enter the operator</p>
  
  <p>&amp;</p>
  
  <p>Enter the operands</p>
  
  <p>12</p>
  
  <p>10</p>
  
  <p>Sample Output</p>
  
  <p>Invalid Operator</p>
  
  <p>My code is:</p>
  
  <pre><code>using System;
  
  public class Program
  {
      public static void Main(string[] args)
      {
          Console.WriteLine("Enter the operator");
          string sign = Console.ReadLine();
          Console.WriteLine("Enter the operands");
          int a = Convert.ToInt32(Console.ReadLine());
          int b = Convert.ToInt32(Console.ReadLine());
          Calculator cal = new Calculator();
          switch (sign)
          {
              case "+":
                  Console.WriteLine("Result of " + a + " + " + b + " is " + cal.Addition(a,b));
                  break;
              case "-":
                  Console.WriteLine("Result of " + a + " - " + b + " is " + cal.Subtraction(a,b));
                  break;
              case "*":
                  Console.WriteLine("Result of " + a + " * " + b + " is " + cal.Multiplication(a,b));
                  break;
              case "/":
                  double[] ans = cal.Division(a,b, out remainder);
                  Console.WriteLine("Result of " + a + " / " + b + " is " + ans[0]);
                  Console.WriteLine("Remainder =" + (int)ans[1]);
                  break;
              default:
                  Console.WriteLine("Invalid Operator");
                  break;
          }
      }
  
  }
  internal class Calculator
  {
      public virtual int Addition(int a, int b)
      {
          return a + b;
      }
      public virtual int Subtraction(int a, int b)
      {
          return a - b;
      }
      public virtual int Multiplication(int a, int b)
      {
          return a * b;
      }
      public virtual double[] Division(int a, int b,out double remainder)
      {
          return new double[]{a / b, a % b};
      }
  }
  </code></pre>
  
  <p>Error:</p>
  
  <p>Proposed grade: 0 / 100
  Result Description
   COMPILE TIME ERROR``
  Comment :=>> CalculatorProgram.cs(25,42): error CS0103: The name <code>remainder' does not exist in the current context
  CalculatorProgram.cs(50,59): error CS0177: The out parameter</code>remainder' must be assigned to before control leaves the current method
  Grade :=>> 0</p>