Exemple #1
0
        public void btnVer_Click(object sender, EventArgs e)
        {
            string TextoN3;
            string TextoN4;
            float  N3;
            float  N4;
            float  Resultado;
            float  Resulatdo2;
            float  Resultado3;
            float  Resultado4;
            float  Resultado5;
            float  Resultado6;
            double ISR    = 0.23;
            double Social = 0.05;
            double Retiro = 0.10;

            TextoN3 = txtTotal_Inicial.Text;
            TextoN4 = txtPrestamo.Text;
            N3      = Convert.ToInt32(txtTotal_Inicial.Text);
            N4      = Convert.ToInt32(txtPrestamo.Text);

            //ISR
            Resultado   = (float)(N3 * ISR);
            txtISR.Text = Resultado.ToString();

            //Ahorro para Retiro
            Resulatdo2     = (float)(N3 * Retiro);
            txtRetiro.Text = Resulatdo2.ToString();

            //Seguridad Social
            Resultado3     = (float)(N3 * Social);
            txtSocial.Text = Resultado3.ToString();

            //Prestamo
            Resultado4       = N4;
            txtPrestamo.Text = Resultado4.ToString();

            Resultado5 = Resultado + Resulatdo2 + Resultado3 + Resultado4;
            Resultado6 = N3 - Resultado5;

            txtSueldo_Final.Text = Resultado6.ToString();
        }
        private void btnsueldofinal_Click(object sender, EventArgs e)
        {
            String txtN3;
            string txtN4;
            float  N3;
            float  N4;
            float  Resultado;
            float  Resultado2;
            float  Resultado3;
            float  Resultado4;
            float  Resultado5;
            float  Resultado6;
            double icr    = 0.23;
            double seguro = 0.05;
            double ahorro = 0.10;

            txtN3 = txtinicial.Text;
            txtN4 = txtprestamo.Text;
            N3    = Convert.ToInt32(txtinicial.Text);
            N4    = Convert.ToInt32(txtprestamo.Text);

            Resultado   = (float)(N3 * icr);
            txtisr.Text = Resultado.ToString();

            Resultado2     = (float)(N3 * seguro);
            txtseguro.Text = Resultado2.ToString();

            Resultado3     = (float)(N3 * ahorro);
            txtahorro.Text = Resultado3.ToString();

            Resultado4       = N4;
            txtprestamo.Text = Resultado4.ToString();

            Resultado5 = Resultado + Resultado2 + Resultado3 + Resultado4;

            Resultado6    = N3 - Resultado5;
            txtfinal.Text = Resultado6.ToString();
        }
Exemple #3
0
        private void Ok_Click(object sender, EventArgs e)
        {
            int Tentativa1, Tentativa2, Tentativa3;

            relogio.Stop();
            Resp1.ReadOnly = true;
            Resp2.ReadOnly = true;
            Resp3.ReadOnly = true;
            bool Pode;

            Pode = int.TryParse(Resp1.Text, out Tentativa1);
            Pode = int.TryParse(Resp2.Text, out Tentativa2);
            Pode = int.TryParse(Resp3.Text, out Tentativa3);
            if (!Pode)
            {
                MessageBox.Show("Entrada Inválida!");
            }
            else
            {
                Tentativa1 = int.Parse(Resp1.Text);
                Tentativa2 = int.Parse(Resp2.Text);
                Tentativa3 = int.Parse(Resp3.Text);
            }

            if (Resp1.Text == null)
            {
                Resp1.Text = "0";
            }
            if (Resp2.Text == null)
            {
                Resp2.Text = "0";
            }
            if (Resp3.Text == null)
            {
                Resp3.Text = "0";
            }
            else
            {
                List <string> Lista     = new List <string>();
                int           ponto     = 0;
                string[]      mensagens = new string[3];
                if (Resultado1 == Tentativa1)
                {
                    Res1.Text      = "Certo!";
                    Res1.ForeColor = Color.Green;
                    ponto++;
                }
                else
                {
                    Res1.Text      = "Errado!";
                    Res1.ForeColor = Color.Red;
                    string erro = "Resposta da questão 1: " + Resultado1.ToString();
                    Lista.Add(erro);
                }
                if (Resultado2 == Tentativa2)
                {
                    Res2.Text      = "Certo!";
                    Res2.ForeColor = Color.Green;
                    ponto++;
                }
                else
                {
                    Res2.Text      = "Errado!";
                    Res2.ForeColor = Color.Red;
                    string erro = "Resposta da questão 2: " + Resultado2.ToString();
                    Lista.Add(erro);
                }
                if (Resultado3 == Tentativa3)
                {
                    Res3.Text      = "Certo!";
                    Res3.ForeColor = Color.Green;
                    ponto++;
                }
                else
                {
                    Res3.Text      = "Errado!";
                    Res3.ForeColor = Color.Red;
                    string erro = "Resposta da questão 3: " + Resultado3.ToString();
                    Lista.Add(erro);
                }
                if (ponto == 3)
                {
                    MessageBox.Show("Muito bem! Você acertou todas as questões :D");
                }
                else
                {
                    string s = "Oops, parece que houveram alguns erros! Veja-os abaixo: \n";
                    foreach (string x in Lista)
                    {
                        s += x + "\n";
                    }
                    MessageBox.Show(s);
                }
            }
        }