viernes, 26 de marzo de 2010

PRACTICA 7 PROBLEMA 2

CONSOLA






VISUAL
CODIGO VISUAL

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;
//Programa que lee productos de una factura y calcula el total mas el 11% de impuesto
//Catherine Arzate Santibañez  09211004
namespace _7_2
{
public partial class Form1 : Form
{
double Bm, Ca, Te, Tm, Pa, TBm, TCa, TTe, TTm, TPa, Total, IVA, SubTotal;
public Form1()
{
InitializeComponent();
Bm = Ca = Te = Tm = Pa = TBm = TCa = TTe = TTm = TPa = Total = IVA = SubTotal = 0;
}
private void button1_Click(object sender, EventArgs e)
{
Bm = double.Parse(textBox1.Text);
Ca = double.Parse(textBox2.Text);
Te = double.Parse(textBox3.Text);
Tm = double.Parse(textBox4.Text);
Pa = double.Parse(textBox5.Text);
TBm = Bm * 28.5;
TCa = Ca * 45.0;
TTe = Te * 99.0;
TTm = Tm * 49.99;
TPa = Pa * 68.5;
SubTotal = TBm + TCa + TTe + TTm + TPa;
IVA = SubTotal * .11;
Total = SubTotal + IVA;
listBox1.Items.Add("Producto\t\tCantidad de producto\tCosto unitario\tSubtotal");
listBox1.Items.Add("");
listBox1.Items.Add("Toallas m\t\t\t" + Tm + "\t\t49.99\t\t" + TTm);
listBox1.Items.Add("");
listBox1.Items.Add("Tenis\t\t\t" + Te + "\t\t99.0\t\t" + TTe);
listBox1.Items.Add("");
listBox1.Items.Add("Pantalon\t\t\t" + Pa + "\t\t68.5\t\t" + TPa);
listBox1.Items.Add("");
listBox1.Items.Add("Camisa\t\t\t" + Ca + "\t\t45.0\t\t" + TCa);
listBox1.Items.Add("");
listBox1.Items.Add("Bolsa mano\t\t" + Bm + "\t\t28.5\t\t" + TBm);
listBox1.Items.Add("");
listBox1.Items.Add("\t\t\t\t\tSubTotal:\t\t" + SubTotal);
listBox1.Items.Add("\t\t\t\t\tIVA:\t\t" + IVA);
listBox1.Items.Add("\t\t\t\t\tTotal:\t\t" + Total);
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
listBox1.Items.Clear();
textBox1.Focus();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}




PSEUDOCODIGO

Inicio
np =0 Int
bm = 0 Int
ca = 0 Int
ts = 0 Int
tm = 0 Int
pt = 0 Int
total = 0.0 Double
continuar = 0 Int
do
{
Clear
Print “Listado de productos”
Print “No. Productos descripción precio”
Print “ 1 bolsa de mano $28.50”
Print “ 2 camiseta $45.00”
Print “ 3 tenis $99.00”
Print “ 4 toalla m $49.99”
Print “ 5 pantalon $68.50”
Print “Seleccione el número de producto (1 – 5)”
Read np

switch (np)
{
case 1:
Print “Cantidad de bolsas de mano: ”
Read bm
total = total + bm * 28.50
break
case2:
Print “Cantidad de camisetas: ”
Read ca
total = total + ca * 45.00
break
case 3:
Print “Cantidad de tenis: ”
Read ts
total = total + ts * 99.00
break
case 4:
Print “Cantidad de toallas m: ”
Read tm
total = total + tm * 49.99
break
case 5:
Print “Cantidad de pantalón: ”
Read pt
total = total + pt * 68.50
break
default:
Print “Presionó opción equivocada”
break
}
Print “Otro producto 1 Para continuar 0 cálculo factura”
Read continuar
}

while (continuar == 1)
Print “Cantidad producto subtotal”
If (bm > 0)
{
Print “{0} bolsa de mano {1}”, bm, bm * 28.50
}
If (ca > 0)
{
Print “{0} camiseta {1}”, ca, ca * 45.00
}
If (ts > 0)
{
Print “{0} Tenis {1}”, ts, ts * 99.00
}
If (tm > 0)
{
Print “{0} Toalla m {1}”, tm, tm * 49.99
}
If (pt > 0)
{
Print “{0} Pantalón {1}”, pt, pt * 68.50
}
Print “ Subtotal = {0}”, total
Print “ IVA (11%) = {0}”, total * 0.11
Print “ Total = {0}”, total * 1.11
Fin








No hay comentarios:

Publicar un comentario