You are on page 1of 1

Exercícios IF 02

private void btTotal_Click(object sender, EventArgs e)


{
double Qta, Puni, Ptot, Vfin;

Qta = Convert.ToDouble(txtQta.Text);
Puni = Convert.ToDouble(txtPuni.Text);
Ptot = Qta * Puni;
txtPtot.Text = Ptot.ToString("0.00 €");

if (Qta >= 100 && Qta <= 500)


{
Vfin = Ptot / 1.1;
txtPerc.Text = "10 %";
txtVdesc.Text = (Ptot - Vfin).ToString("0.00 €");
txtPfinal.Text = Vfin.ToString("0.00 €");
}
if (Qta >= 500)
{
Vfin = Ptot / 1.2;
txtPerc.Text = "20 %";
txtVdesc.Text = (Ptot - Vfin).ToString("0.00 €");
txtPfinal.Text = Vfin.ToString("0.00 €");
}
}

private void btLimpar_Click(object sender, EventArgs e)


{
txtQta.Clear();
txtPuni.Clear();
txtPtot.Clear();
txtPerc.Clear();
txtVdesc.Clear();
txtPfinal.Clear();
txtQta.Focus();
}

private void txtPuni_TextChanged(object sender, EventArgs e)


{
lblEu.Visible = true;
}

You might also like