{
public partial class Form1 : Form
{
double BM, C, T, To, P = 0.0;
double Total = 0.0;
string opcion;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
opcion = (textBox1.Text);
switch (opcion)
{
case "1":
BM = double.Parse(textBox2.Text);
Total = Total + BM * 28.50;
break;
case "2":
C = int.Parse(textBox2.Text);
Total = Total + C * 45.00;
break;
case "3":
T = int.Parse(textBox2.Text);
Total = Total + T * 99.0;
break;
case "4":
To = int.Parse(textBox2.Text);
Total = Total + To * 49.99;
break;
case "5":
P = int.Parse(textBox2.Text);
Total = Total + P * 68.50;
break;
default: label9.Text = "ERROR";
break;
}
}
private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Add("\nCantidad Producto Subtotal");
if (BM > 0)
{
listBox1.Items.Add("" + BM + " Bolsa de mano " + BM * 28.50);
}
if (C > 0)
{
listBox1.Items.Add("" + C + " Camisa " + C * 45.00);
}
if (T > 0)
{
listBox1.Items.Add("" + T + " Tenis " + T * 99.00);
}
if (To > 0)
{
listBox1.Items.Add("" + To + " Toalla M. " + To * 49.99);
}
if (P > 0)
{
listBox1.Items.Add("" + P + " Pantalon " + P * 68.50);
}
listBox1.Items.Add(" Subtotal= " + Total);
listBox1.Items.Add(" IVA(11%)= " + Total * 0.11);
listBox1.Items.Add(" total= " + Total * 1.11);
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
listBox1.Items.Clear();
}
private void button4_Click(object sender, EventArgs e)
{
Close();
}
}
}


namespace practica7problema2C
{
class Program
{
static void Main(string[] args)
{
double BM=0.0,C=0.0,T=0.0,To=0.0,P=0.0,Total=0.0;
char continuar;
do
{
Console.Clear();
Console.WriteLine("Nombre de producto\t Descripcion\t Precio de lista");
Console.WriteLine("1\t Bolsa de mano\t $28.50");
Console.WriteLine("2\t Camisa\t $45.0");
Console.WriteLine("3\t Tenis\t $99.0");
Console.WriteLine("4\t Toalla M.\t $49.99");
Console.WriteLine("5\t Pantalon\t $68.50");
Console.WriteLine("Seleccione un articulo del (1-5)");
string opcion = (Console.ReadLine());
switch (opcion)
{
case "1": Console.WriteLine("Cantidad de Bolsas de mano:");
BM=double.Parse(Console.ReadLine());
Total= Total + BM*28.50;
break;
case "2": Console.WriteLine("Cantidad de Camisas:");
C=double.Parse(Console.ReadLine());
Total= Total + C*45.0;
break;
case "3": Console.Write("Cantidad de Tenis:");
T=double.Parse(Console.ReadLine());
Total= Total + T*99.0;
break;
case "4": Console.WriteLine("Cantidad de Toallas M.:");
To=double.Parse(Console.ReadLine());
Total= Total + To*49.99;
break;
case "5": Console.WriteLine("Cantidad de Pantalones:");
P=double.Parse(Console.ReadLine());
Total= Total + P*68.50;
break;
default:
Console.WriteLine("ERROR");
break;
}
Console.Write("Desea agregar otro producto s Si / n No : ");
continuar = char.Parse(Console.ReadLine());
}
while (continuar == 's');
Console.WriteLine("Cantidad Producto Subtotal");
if (BM > 0)
{
Console.WriteLine("{0}\t\tBolsa de Mano\t\t{1}", BM, BM * 28.50);
}
if (C > 0)
{
Console.WriteLine("{0}\t\tCamisa\t\t\t{1}", C, C * 45.0);
}
if (T > 0)
{
Console.WriteLine("{0}\t\tTenis\t\t{1}", T, T * 99.0);
}
if (To > 0)
{
Console.WriteLine("{0}\t\tToalla\t\t{1}", To, To * 49.99);
}
if (P > 0)
{
Console.WriteLine("{0}\t\tPantalon\t\t{1}", P, P * 68.50);
}
Console.WriteLine("El subtotal de la compra es={0}", Total);
Console.WriteLine("El IVA(11%) es igual a={0}", Total * 0.11);
Console.WriteLine("El total de la compra es={0}", Total * 1.11);
Console.ReadKey();
}
}
}
No hay comentarios:
Publicar un comentario