Пример #1
0
        public void Add_TestPass(double op1, double op2, double res)
        {
            calc objcalc = new calc();

            objcalc.Add(op1, op2);
            Assert.Equal(res, objcalc.result);
        }
Пример #2
0
        public ActionResult Index(calc c, String calculate)
        {
            if (calculate == "bmic")
            {
                c.bmi = ((c.weight / (c.height * c.height)) * 703);

                if (c.bmi < 18.5)
                {
                    c.bmi_text = "UNDERWEIGHT";
                }
                else if (c.bmi < 20)
                {
                    c.bmi_text = "NORMAL";
                }
                else if (c.bmi < 30)
                {
                    c.bmi_text = "OVER WEIGHT";
                }
                else
                {
                    c.bmi_text = "OBESE";
                }
            }

            return(View(c));
        }
Пример #3
0
        public void Add_TestTrue()
        {
            calc objcalc = new calc();

            objcalc.Add(20, 10);
            Assert.Equal(30, objcalc.result);
        }
Пример #4
0
        public void Subtract_TestPass(double op1, double op2, double res)
        {
            calc objcalc = new calc();

            objcalc.Subtract(op1, op2);
            Assert.Equal(res, objcalc.result);
        }
Пример #5
0
        public void TC1_Divide9by0()
        {
            IUSD_CLP_ExchangeRateFeed feed = this.prvActualUSDValue();
            ICalculator calc1 = new calc(feed);

            Assert.That(() => calc1.Divide(9, 0), Throws.TypeOf <DivideByZeroException>());
        }
        public ActionResult Index(calc c, string calculate)
        {
            switch (calculate)
            {
            case "add":
                c.total = "" + (c.val1 + c.val2);
                break;

            case "min":
                c.total = "" + (c.val1 - c.val2);
                break;

            case "sub":
                c.total = "" + (c.val1 * c.val2);
                break;

            case "dii":
                if (c.val2 == 0)
                {
                    c.total = "Không chia được cho 0";
                }
                else
                {
                    c.total = "" + (c.val1 / c.val2);
                }
                break;
            }
            return(View(c));
        }
Пример #7
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Введите 1ое слогаемое x:");
            int x = Convert.ToInt16(Console.ReadLine());
            Console.WriteLine("Введите ое слогаемое y:");
            int y = Convert.ToInt16(Console.ReadLine());
            Console.WriteLine("Введите множитель z:");
            int z = Convert.ToInt16(Console.ReadLine());

            var calc = new calc();
            Func<int, int, int, int> func = calc.fFunc;
            Console.WriteLine("Результат операции (x+y)*z: " + func(x, y, z));
            Console.ReadKey();

            Console.WriteLine("Введите первую половину слова");
            string s = Console.ReadLine();
            Console.WriteLine("Введите вторую половину слова");
            string s1 = Console.ReadLine();

            var Str = new Str();
            Console.WriteLine("Результатом сложения половины слов является:" + Str.SFunc(s, s1));
            Console.ReadKey();

            bool[] bo = new[] { true, false, false, false, false, false };
            bool[] boo = (bool[])Enumerable.Where(bo, a => a == false);
            int len = boo.Length;
            Console.WriteLine("Количество элементов массива со значением false =" + len);
        }
Пример #8
0
        public ActionResult index(calc c, string calculate)
        {
            double result = 0.0;

            if (calculate == "divv")
            {
                result = c.WEIGHT / (c.HEIGHT * c.HEIGHT);
                if (result < 18.5)
                {
                    c.BMI = "Your BMI is " + result.ToString("#.#") + ". You are underweight";
                }
                else
                if (result < 25)
                {
                    c.BMI = "Your BMI is " + result.ToString("#.#") + ". You are normal weight";
                }
                else
                if (result < 30)
                {
                    c.BMI = "Your BMI is " + result.ToString("#.#") + ". You are overweight";
                }
                else
                if (result > 30)
                {
                    c.BMI = "Your BMI is " + result.ToString("#.#") + ". You are obesed";
                }
            }
            return(View(c));
        }
Пример #9
0
        public void TestPremier()
        {
            int  a      = 19;
            calc calc   = new calc();
            bool result = calc.Premier(a);

            Assert.AreEqual(true, result);
        }
Пример #10
0
        public void TestPaire()
        {
            int  a      = 22;
            calc calc   = new calc();
            bool result = calc.paireImpaire(a);

            Assert.AreEqual(true, result);
        }
Пример #11
0
        public void TC1_Divide9by3()
        {
            IUSD_CLP_ExchangeRateFeed feed = this.prvActualUSDValue();
            ICalculator calc1 = new calc(feed);
            int         res   = calc1.Divide(9, 3);

            Assert.AreEqual(3, res);
        }
Пример #12
0
        static void Main(string[] args)
        {
            calc cal = new calc();

            Console.WriteLine(cal.sum(2, 3));
            Console.WriteLine(cal.multiplication(2, 3));
            Console.ReadKey();
        }
Пример #13
0
        public void Testmod()
        {
            int  a      = 22;
            int  b      = 2;
            calc calc   = new calc();
            int  result = calc.modulo(a, b);

            Assert.AreEqual(0, result);
        }
Пример #14
0
        public void Testadd()
        {
            int  a      = 15;
            int  b      = 65;
            calc calc   = new calc();
            int  result = calc.add(a, b);

            Assert.AreEqual(80, result);
        }
Пример #15
0
        public void TestMulti()
        {
            int  a      = 2;
            int  b      = 11;
            calc calc   = new calc();
            int  result = calc.Multi(a, b);

            Assert.AreEqual(22, result);
        }
Пример #16
0
        public void TestMoins()
        {
            int  a      = 22;
            int  b      = 11;
            calc calc   = new calc();
            int  result = calc.moins(a, b);

            Assert.AreEqual(11, result);
        }
Пример #17
0
        public void Testdiv()
        {
            int  a      = 22;
            int  b      = 2;
            calc calc   = new calc();
            int  result = calc.div(a, b);

            Assert.AreEqual(11, result);
        }
Пример #18
0
        static void Main(string[] args)
        {
            var c = new calc();

            System.Console.WriteLine(c.add(2, 3)); //5

            var a = new int[] { 1, 5, 12, -2 };

            System.Console.WriteLine(c.add(a)); //16
        }
Пример #19
0
        static void Main(string[] args)
        {
            Console.WriteLine("Podaj liczbę");

            var myCalc = new calc();

            myCalc.Sum(1, 1);

            Console.ReadKey();
        }
Пример #20
0
        private void button1_Click(object sender, EventArgs e)
        {
            var a   = int.Parse(textBox1.Text);
            var b   = int.Parse(textBox2.Text);
            var cal = new calc();

            listBox1.Items.Add(string.Format("{0} + {1} = {2}", a, b, cal.Penambahan(a, b)));
            listBox1.Items.Add(string.Format("{0} - {1} = {2}", a, b, cal.Pengurangan(a, b)));
            listBox1.Items.Add(string.Format("{0} * {1} = {2}", a, b, cal.Perkalian(a, b)));
            listBox1.Items.Add(string.Format("{0} / {1} = {2}", a, b, calc.Pembagian(a, b)));
        }
Пример #21
0
        static void Main(string[] args)
        {
            calc <int> c = new calc <int>();

            Console.WriteLine(c.yaz(5));
            Console.ReadKey();

            calc <int> c2 = new calc2();

            Console.WriteLine(c2.yaz(5));
            Console.ReadKey();
        }
Пример #22
0
        static void Main(string[] args)
        {
            var David = new Person();

            David.VoorNaam   = "David";
            David.AchterNaam = " Duym";
            David.Introduce();

            var calc   = new calc();
            var result = calc.Add(1, 2);

            Console.WriteLine(result);
        }
Пример #23
0
        static void Main(string[] args)
        {
            DateTime today = new DateTime(2016, 6, 22);
            calc     o     = new calc();
            property p     = new property();

            p.Test = 123;
            calc.operation();
            Console.WriteLine("Today:{0}", DateTime.Today);
            Console.WriteLine("Date:{0}", today);
            Console.WriteLine("Property value:" + p.Test);
            Console.ReadLine();
        }
Пример #24
0
        static void Main(string[] args)
        {
            var c = new calc();

            System.Console.WriteLine(c.add(2, 3));      //5
            System.Console.WriteLine(c.subtract(1, 3)); //-2
            System.Console.WriteLine(c.multiply(13, 2));
            System.Console.WriteLine(c.divide(13, 2));

            var a = new int[] { 1, 5, 12, -2 };

            System.Console.WriteLine(c.add(a)); //16
        }
Пример #25
0
    public static void Main()
    {
        //dele b = new dele(ali);
        dele w = new dele(medo);
//          Console.WriteLine(w(2, 3));
        calc      d = new calc();
        delegatee del;

        del = d.sum;
        Console.WriteLine(del(10, 20));
        del = d.sub;
        Console.WriteLine(del(20, 10));
    }
Пример #26
0
        public IActionResult Index(calc objParamCalc)
        {
            calc objCalc = new calc();
            switch(objParamCalc.strOperator)
            {
                case "add" :
                    objCalc.Add(objParamCalc.operand1,objParamCalc.operand2);
                    break;
                case "sub" :
                    objCalc.Subtract(objParamCalc.operand1,objParamCalc.operand2);
                    break;
            }

            return View(objCalc);
        }
Пример #27
0
        static void Main(string[] args)
        {
            Console.WriteLine("Deligate Demo");
            Base b = new Base
            {
                a = 4,
                b = 5
            };
            calc pd = new calc(b.add);

            pd += b.mul;
            pd += b.div;
            pd += b.mod;
            pd += b.sub;

            b.printResult(pd);
        }
        static void Main(string[] args)
        {
            int a = 12;
            int b = 20;
            //add(a, b);

            calc calculator = add;

            calculator += sub;
            calculator += mul;
            calculator(a, b);
            Console.WriteLine("--------------------");
            calculator(2, 2);
            Console.WriteLine("--------------------");
            calculator -= sub;

            calculator(1, 1);
        }
Пример #29
0
        private void LoadSelection()
        {
            G.SelectionWell.QUERRY()
            .SHOW
            .WHERE
            .ARC(C.SelectionWell.Sample, C.Sample.YM).EQUI.BV(YM - 1)
            .DO();
            calcs = new calc[G.SelectionWell.Rows.Count];
            load_sw openFile = new load_sw(calcs.Length, new Func <int, bool>(
                                               IndexRow =>
            {
                calcs[IndexRow] = new calc(G.SelectionWell.Rows.GetID(IndexRow));
                return(true);
            }));

            _progress = new Progress_Form(openFile);
            _progress.ShowDialog();
        }
Пример #30
0
 public void loadCfg()
 {
     try
     {
         if (!File.Exists("config.cfg"))
         {
             this.username        = "******";
             this.minMAAlert      = 10;
             this.minDevAlert     = 70;
             this.lastupdate      = DateTime.Today;
             this.itemList        = new List <ListItem>();
             this.hotdeals        = 5;
             this.minVolume       = 0;
             this.minMA           = 10;
             this.calculationType = calc.MinMax;
             this.relicsExcluded  = true;
             this.modsExcluded    = true;
             this.setsExcluded    = true;
             this.buyorderdev     = 5;
             this.hdsetsExcluded  = true;
             File.WriteAllText("config.cfg", new JavaScriptSerializer().Serialize(this));
         }
         Config cfg = new JavaScriptSerializer().Deserialize <Config>(File.ReadAllText("config.cfg"));
         this.username        = cfg.username;
         this.minMAAlert      = cfg.minMAAlert;
         this.minDevAlert     = cfg.minDevAlert;
         this.lastupdate      = cfg.lastupdate;
         this.itemList        = cfg.itemList;
         this.hotdeals        = cfg.hotdeals;
         this.minMA           = cfg.minMA;
         this.minVolume       = cfg.minVolume;
         this.calculationType = cfg.calculationType;
         this.relicsExcluded  = cfg.relicsExcluded;
         this.modsExcluded    = cfg.modsExcluded;
         this.setsExcluded    = cfg.setsExcluded;
         this.buyorderdev     = cfg.buyorderdev;
         this.hdsetsExcluded  = cfg.hdsetsExcluded;
     }
     catch
     {
         MessageBox.Show("Fatal error while initializing config.");
         Environment.Exit(1);
     }
 }
Пример #31
0
 public ActionResult Index(calc c, string calculate)
 {
     if (calculate == "add")
     {
         c.Total = c.number_1 + c.number_2;
     }
     else if (calculate == "sub")
     {
         c.Total = c.number_1 - c.number_2;
     }
     else if (calculate == "mul")
     {
         c.Total = c.number_1 * c.number_2;
     }
     else
     {
         c.Total = c.number_1 / c.number_2;
     }
     return(View(c));
 }