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
{
public Form1()
{
InitializeComponent();
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btcalcular_Click(object sender, EventArgs e)
{
double largo, ancho, precioxm2, area,precio;
largo = double.Parse(txtlargo.Text);
ancho = double.Parse(txtancho.Text);
precioxm2=double.Parse(txtprecioxm2.Text);
area=largo*ancho;
precio = area*precioxm2;
if (area<=500) {txtprecio.Text=precio.ToString(); txtdescuento.Text = ("0%"); } else if (area > 500 && area <= 1000) { precio = precio-(precio * .15); txtprecio.Text = precio.ToString(); txtdescuento.Text = ("15%"); } else if (area > 1000)
{
precio = precio-(precio * .25);
txtprecio.Text = precio.ToString();
txtdescuento.Text=("25%");
}
}
private void txtprecioxm2_TextChanged(object sender, EventArgs e)
{
}
private void btlimpiar_Click(object sender, EventArgs e)
{
txtlargo.Clear();
txtancho.Clear();
txtprecioxm2.Clear();
txtdescuento.Clear();
txtprecio.Clear();
txtlargo.Focus();
}
private void btsalir_Click(object sender, EventArgs e)
{
Close();
}
}
}
No hay comentarios:
Publicar un comentario