Beispiel #1
0
        public ActionResult Index(string BRadius, string sradius, string height)
        {
            double Square = new Math_1().Formula(Convert.ToDouble(BRadius), Convert.ToDouble(sradius), Convert.ToDouble(height));

            ViewBag.Result = Square;
            return(View());
        }
Beispiel #2
0
        public ActionResult Index(string radius, string height)
        {
            double Square = Math.Round(Math_1.Formula(Convert.ToDouble(radius), Convert.ToDouble(height)), 3);

            ViewBag.result = Square;
            return(View());
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Введите r");
            double r = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("Введите r1");
            double r1 = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("Введите l");
            double l = Convert.ToDouble(Console.ReadLine());

            if (r <= 0)
            {
                Console.WriteLine("Введите положительное число");
            }
            else if (r1 <= 0)
            {
                Console.WriteLine("Введите положительное число");
            }
            else if (l <= 0)
            {
                Console.WriteLine("Введите положительное число");
            }
            else
            {
                double answer = Math.Round(Math_1.Formula(r, r1, l), 3);
                Console.WriteLine($"{answer}");
            }
            Console.ReadKey();
        }
Beispiel #4
0
        public ActionResult Index(string radius, string radius1, string length)
        {
            double Square = Math.Round(Math_1.Formula(Convert.ToDouble(radius), Convert.ToDouble(radius1), Convert.ToDouble(length)), 2);

            ViewBag.result = Square;
            return(View());
        }
Beispiel #5
0
        public void Test2()
        {
            double s = Math_1.Formula(10, 5);

            Assert.Throws <System.ArgumentException>(() => {
                double s = Math_1.Formula(-10, 5);
            });
        }
Beispiel #6
0
 private void Result_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         txt_Result.Text = Convert.ToString(Math.Round(Math_1.Formula(Convert.ToDouble(txt_Height.Text), Convert.ToDouble(txt_Radius.Text)), 3));
     }
     catch (FormatException)
     {
         MessageBox.Show("Неверно введено число.");
     }
 }
Beispiel #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("Введите радиус");
            double radius = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("Введите высоту");
            double height = Convert.ToDouble(Console.ReadLine());

            if (height <= 0)
            {
                Console.WriteLine("Высота не может быть такой... тупица");
            }
            else if (radius <= 0)
            {
                Console.WriteLine("Введите положительный радиус");
            }
            else
            {
                double answer = Math.Round(Math_1.Formula(radius, height), 3);
                Console.WriteLine($"{answer}");
            }
            Console.ReadKey();
        }
Beispiel #8
0
        public void Test1()
        {
            double s = Math_1.Formula(10, 5);

            Assert.AreEqual(314.15, s, 0.01);
        }
Beispiel #9
0
        public void Test1()
        {
            double s = Math_1.Formula(3, 4, 5);

            Assert.AreEqual(109.9, s, 0.1);
        }