コード例 #1
0
ファイル: Program.cs プロジェクト: wnoel11/Lab09
        static void Main(string[] args)
        {
            MyMath myResult1 = new MyMath();

            myResult1.Multiply(2, 5);
            Console.WriteLine(myResult1.GetResult());

            myResult1.Divide(10, 5);
            Console.WriteLine(myResult1.GetResult());

            myResult1.Subtract(7, 6);
            Console.WriteLine(myResult1.GetResult());

            myResult1.Add(8, 4);
            Console.WriteLine(myResult1.GetResult());
        }
コード例 #2
0
        static void Main(string[] args)
        {
            MyMath result1 = new MyMath();

            result1.Multiply(2, 3);
            Console.WriteLine("The result is: " + result1.getResult());

            result1.Divide(2, 3);
            Console.WriteLine("The result is: " + result1.getResult());

            result1.Add(2, 3);
            Console.WriteLine("The result is: " + result1.getResult());

            result1.Subtract(2, 3);
            Console.WriteLine("The result is: " + result1.getResult());
        }
コード例 #3
0
        static void Main(string[] args)
        {
            int product = MyMath.Multiply(2, 2);
            { Console.WriteLine(product); }

            int quotient = MyMath.Divide(10, 2);
            { Console.WriteLine(quotient); }

            MyMath mathobj1 = new MyMath();
            int    sum      = mathobj1.Add(1, 2);
            { Console.WriteLine(sum); }

            MyMath mathobj2   = new MyMath();
            int    difference = mathobj2.subtract(1, 2);
            { Console.WriteLine(difference); }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: IT1050-TobyBly/Lab09
        static void Main(string[] args)
        {
            MyMath iMyMath = new MyMath();



            iMyMath.Multiply(10, 20);
            Console.WriteLine("The result for multiplication is: " + iMyMath.GetResult());

            iMyMath.Divide(30, 20);
            Console.WriteLine("The result of division is:" + iMyMath.GetResult());

            iMyMath.Subtract(20, 10);
            Console.WriteLine("The result of subtraction is:" + iMyMath.GetResult());

            iMyMath.Add(100, 200);
            Console.WriteLine("The result of addition is:" + iMyMath.GetResult());
        }
コード例 #5
0
        static void Main(string[] args)
        {
            //This doesn't meet all the requirements of the assignment, but it's as close as I can get right now
            //I'm not sure how to use the GetResult method in combination with the void methods in MyMath class

            MyMath MM = new MyMath();

            double operand1;
            double operand2;
            double result;



            MM.Multiply(30, 2);
            MM.Divide(35, 7);
            MM.Add(23, 2);
            MM.Subtract(17, 2);
        }