![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs8q2vTaHEBAG6ePaqC-P_4dqd8_aRSGZtV_ujyaxDAAhcR_FeyHhFdnmexLd38l4EoNNmuz1BvYTc6MOsV12_KamPYBt8bWVGevasP8t-v1epIE-GRMIeVitT7oShsy-fypVzXspFTX1H/s320/descc.bmp)
ESTRUCTURA DEL PROGRAMA VISUAL .PARA EL CALCULO DE DESCUENTOS.
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
int cant,precio,total,descuento,pago;
public Form1()
{
cant = precio = total = descuento = pago = 0;
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void bxTotal_TextChanged(object sender, EventArgs e)
{
}
private void Calcular_Click(object sender, EventArgs e)
{
cant = int.Parse(bxcant.Text);
precio = int.Parse(bx.Text);
total = cant * precio;
bxTotal.Text = total.ToString();
if (cant > 100)
{
descuento = (total * 40) / 100;
bxDescuento.Text =descuento.ToString();
pago = total - descuento;
bxPago.Text = pago.ToString();
}
else
if (cant > 24)
{
descuento = (total * 20) / 100;
bxDescuento.Text =descuento.ToString();
pago = total - descuento;
bxPago.Text = pago.ToString();
}
else
if (cant > 9)
{
descuento = (total * 10) / 100;
bxDescuento.Text = descuento.ToString();
pago = total - descuento;
bxPago.Text = pago.ToString();
}
else
descuento = 0;
bxDescuento.Text = descuento.ToString();
pago = total - descuento;
bxPago.Text = pago.ToString();
}
private void Limpiar_Click(object sender, EventArgs e)
{
bx.Clear();
bxcant.Clear();
bxDescuento.Clear();
bxPago.Clear();
bxTotal.Clear();
}
private void Salir_Click(object sender, EventArgs e)
{
Close();
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}
No hay comentarios:
Publicar un comentario