
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace practica_sabe
{
public partial class Form1 : Form
{
double cantidad, precio, total, descuento, pago;
public Form1()
{
InitializeComponent();
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
cantidad = double.Parse(textBox1.Text);
precio = double.Parse(textBox2.Text);
if (cantidad > 100)
{
label6.Text = (" 40% de descuento");
total = cantidad * precio;
descuento = total * .40;
pago = total - descuento;
textBox3.Text = total.ToString();
textBox4.Text = descuento.ToString();
textBox5.Text = pago.ToString();
}
else if (cantidad >= 25)
{
label6.Text = (" 20% de descuento");
total = cantidad * precio;
descuento = total * .20;
pago = total - descuento;
textBox3.Text = total.ToString();
textBox4.Text = descuento.ToString();
textBox5.Text = pago.ToString();
}
else if (cantidad >= 10)
{
label6.Text = (" 10% de descuento");
total = cantidad * precio;
descuento = total * .10;
pago = total - descuento;
textBox3.Text = total.ToString();
textBox4.Text = descuento.ToString();
textBox5.Text = pago.ToString();
}
else
{
label6.Text = ("No hay descuento");
total = cantidad * precio;
descuento = 0;
pago = total - descuento;
textBox3.Text = total.ToString();
textBox4.Text = descuento.ToString();
textBox5.Text = pago.ToString();
}
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
label6.Text="";
}
private void label1_Click(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
}
}

No hay comentarios:
Publicar un comentario