コード例 #1
0
 private void btnCalcular_Click(object sender, EventArgs e)
 {
     try
     {
         double Inv1 = Convert.ToDouble(txtInversion1.Text), Inv2 = Convert.ToDouble(txtInversion2.Text), Inv3 = Convert.ToDouble(txtInversion3.Text), P1, P2, P3, Total;
         if ((Inv1 > 0 && Inv2 > 0) && Inv3 > 0)
         {
             Total         = Inv1 + Inv2 + Inv3;
             P1            = Inv1 / Total;
             P2            = Inv2 / Total;
             P3            = Inv3 / Total;
             txtPer1.Text  = P1.ToString("P2");
             txtPer2.Text  = P2.ToString("P2");
             txtPer3.Text  = P3.ToString("P2");
             txtTotal.Text = Total.ToString("C2");
         }
         else
         {
             MessageBox.Show("Los números ingresados deben corresponder a cantidades positivas de dinero, favor revisar la información", "Datos no validos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Los datos ingresados deben ser números reales", "Error de Datos", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: wangyao616/17050401
        private void button1_Click(object sender, EventArgs e)
        {
            double Y, B, Z, W, G, M, P1, P2, P3;
            string y, b, z, w, g;

            y = textBox1.Text;
            z = textBox3.Text;
            g = textBox5.Text;

            Y = System.Convert.ToDouble(y);
            Z = System.Convert.ToDouble(z);

            G = System.Convert.ToDouble(g);


            M  = 4080 * Math.Exp(0.28 * (Y - 1960));
            P1 = 0.048 * Math.Pow(0.72, (Y - 1974));
            P3 = (M / (Z * 30)) * G + (P1 * M);



            label4.Text = M.ToString();
            label5.Text = P1.ToString();
            label6.Text = P3.ToString();
        }
コード例 #3
0
ファイル: Arithmetic.cs プロジェクト: robinreigns/IoTGateway
        public void Test_03_Addition()
        {
            PrimeFieldCurve C = new NistP256();

            byte[]       k1, k2, k3;
            PointOnCurve P1, P2, P3;
            string       s1, s2, s3;
            int          i;

            for (i = 0; i < 100; i++)
            {
                k1 = C.GenerateSecret();
                P1 = C.ScalarMultiplication(k1, C.PublicKeyPoint, true);
                s1 = P1.ToString();

                do
                {
                    k2 = C.GenerateSecret();
                    P2 = C.ScalarMultiplication(k2, C.PublicKeyPoint, true);
                    s2 = P2.ToString();
                }while (k2 == k1);

                Assert.AreNotEqual(P2, P1);
                Assert.AreNotEqual(s2, s1);

                do
                {
                    k3 = C.GenerateSecret();
                    P3 = C.ScalarMultiplication(k3, C.PublicKeyPoint, true);
                    s3 = P3.ToString();
                }while (k3 == k1 || k3 == k2);

                Assert.AreNotEqual(P3, P1);
                Assert.AreNotEqual(s3, s1);
                Assert.AreNotEqual(P3, P2);
                Assert.AreNotEqual(s3, s2);

                PointOnCurve S1 = P1;
                C.AddTo(ref S1, P2);
                C.AddTo(ref S1, P3);

                PointOnCurve S2 = P2;
                C.AddTo(ref S2, P3);
                C.AddTo(ref S2, P1);

                PointOnCurve S3 = P3;
                C.AddTo(ref S3, P1);
                C.AddTo(ref S3, P2);

                Assert.AreEqual(S1, S2);
                Assert.AreEqual(S2, S3);

                Assert.AreEqual(s1, P1.ToString());
                Assert.AreEqual(s2, P2.ToString());
                Assert.AreEqual(s3, P3.ToString());
            }
        }
コード例 #4
0
        public override ArrayList GetItemInfo()
        {
            ArrayList itemInfo = new ArrayList
            {
                new InputText(this, "P1:", P1.ToString(), true, "p1"),
                new InputText(this, "U1:", U1.ToString(), true, "u1"),
                new InputText(this, "V1:", V1.ToString(), true, "v1"),

                new InputText(this, "P2:", P2.ToString(), true, "p2"),
                new InputText(this, "U2:", U2.ToString(), true, "u2"),
                new InputText(this, "V2:", V2.ToString(), true, "v2"),

                new InputText(this, "P3:", P3.ToString(), true, "p3"),
                new InputText(this, "U3:", U3.ToString(), true, "u3"),
                new InputText(this, "V3:", V3.ToString(), true, "v3"),

                new InputText(this, "Material:", Enum.GetName(typeof(P3DMaterial), Material), false, ""),
            };

            return(itemInfo);
        }
コード例 #5
0
ファイル: Triangle.cs プロジェクト: vijirams/TuryUtilCs
 /// <summary>
 /// Returns a string describing the triangle by it's points.
 /// </summary>
 /// <returns>string describing the triangle</returns>
 public override string ToString()
 {
     return("Triangle: {" + P1.ToString() + "\n\t" +
            P2.ToString() + "\n\t" + P3.ToString() + "}");
 }
コード例 #6
0
 public override string ToString()
 {
     return(P1.ToString( ) + " " + P2.ToString( ) + " " + P3.ToString( ));
 }