miércoles, 24 de marzo de 2010

practica 7

Practica 7_1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string nombre;
char sexo;
int edad;
float estatura;
float peso;
int color_ojos;
int color_cabello;
int Num_F = 0;
int Num_M = 0;
int continuar = 1;
while (continuar == 1)
{
Console.WriteLine("Nombre estudiante : ");
nombre = Console.ReadLine();
Console.WriteLine("Sexo(F=Femenino M= Masculino)");
sexo = char.Parse(Console.ReadLine());
Console.WriteLine("Edad");
edad = int.Parse(Console.ReadLine());
Console.WriteLine("Estatura");
estatura = float.Parse(Console.ReadLine());
Console.WriteLine("Peso (en kilos)");
peso = float.Parse(Console.ReadLine());
Console.WriteLine("Color de ojos(1 azul, 2 castaño, 3otro )");
color_ojos = int.Parse(Console.ReadLine());
Console.WriteLine("color de cabellos (1 castaño, 2 rubio, 3 otro)");
color_cabello =int.Parse(Console.ReadLine());
if (sexo =='f' && estatura >= 1.65 && estatura <= 1.75 && peso < num_f =" Num_F" sexo ="=">= 1.70 && peso>=60 &&peso<=70) { Num_M = Num_M + 1; } Console.WriteLine("Desea registriar otro alumno ( 0=n 1 =si)"); continuar = int.Parse(Console.ReadLine()); } Console.WriteLine("Numero de Alumnos sexo femenino color ojos azul estatura >=1.65 y <=1.75, peso<55">1.70 peso entre 60 y 70Kg" + Num_M);
Console.ReadKey();






}
}
}

Practica 7_1 pseudocodigo

Declarar variables
string nombre;
char sexo;
int edad;
float estatura;
float peso;
int color_ojos;
int color_cabello;
int Num_F = 0;
int Num_M = 0;
int continuar = 1;
while (continuar == 1)
{
Print"Nombre estudiante : ";
Read nombre
Print "Sexo(F=Femenino M= Masculino)";
Read sexo
Print"Edad";
Read edad
Print"Estatura";
estatura = float.Parse(Console.ReadLine());
Print"Peso (en kilos)";
read peso;
Print"Color de ojos(1 azul, 2 castaño, 3otro )";
Read color_ojos;
Print "color de cabellos (1 castaño, 2 rubio, 3 otro)";
Read color_cabello ;
if (sexo =='f' && estatura >= 1.65 && estatura <= 1.75 && peso < num_f =" Num_F" sexo ="=">= 1.70 && peso>=60 &&peso<=70) { Num_M = Num_M + 1; } Print"Desea registriar otro alumno ( 0=n 1 =si)"; Read continuar; = } Print"Numero de Alumnos sexo femenino color ojos azul estatura >=1.65 y <=1.75, peso<55">1.70 peso entre 60 y 70Kg" + Num_M);

Practica 7_1 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;

namespace practica_7_1
{


public partial class Form1 : Form
{
string nombre;
char sexo;
int edad;
float Estatura, Peso;
int color_ojos, color_cabello;
int num_F,num_M;
public Form1()
{
InitializeComponent();
nombre = " ";
edad = 0;
Estatura = Peso = 0.0f;
color_ojos = color_cabello =num_F=num_M=0;
}

private void button1_Click(object sender, EventArgs e)
{
nombre = textBox1.Text;
if (checkBox1.Checked)
{
sexo = 'F';
}

if (checkBox2.Checked)
{
sexo = 'M';
}
edad = int.Parse(textBox2.Text);
Estatura = float.Parse(textBox3.Text);
Peso = float.Parse(textBox4.Text);
if (checkBox3.Checked)
{
color_ojos=1;
}
if (checkBox4.Checked)
{
color_ojos = 2;
}
if (checkBox5.Checked)
{
color_ojos = 3;
}
if (checkBox6.Checked)
{
color_cabello = 1;
}
if (checkBox7.Checked)
{
color_cabello = 2;
}
if (checkBox8.Checked)
{
color_cabello = 3;
}
if (sexo == 'F' && color_cabello ==2&& color_ojos==1 && Estatura >= 1.65f && Estatura <= 1.75f && Peso < 55)
{
num_F++;
}
if (sexo =='M'&& color_ojos == 2 && Estatura >1.70f && Peso >= 60&& Peso <= 70)
{
num_M++;
}

listBox1.Items.Add("No. de mujeres " + num_F);
listBox1.Items.Add("No de Hombres " + num_M);






}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = " ";
textBox2.Text = " ";
textBox3.Text = " ";
textBox4.Text = " ";
checkBox1.Checked = false;
checkBox2.Checked = false;
checkBox3.Checked = false;
checkBox4.Checked = false;
checkBox5.Checked = false;
checkBox6.Checked = false;
checkBox7.Checked = false;
checkBox8.Checked = false;
listBox1.Items.Clear();




Practica 7_2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int opcion;
double bm=0;
double camisa = 0;
double tenis = 0;
double toallaM = 0;
double pantalon = 0;
double valor= 0;
int continuar = 1;
Console.WriteLine("Numero de producto\tDescripcion\tPrecio de lista");
Console.WriteLine("\n1\t\t\tBolsa de mano\t$28.50\n2\t\t\tCamisa\t\t$45.0\n3\t\t\tTenis\t\t$99.0\n4\t\t\tToalla M\t$49.99\n5\t\t\tPantalon\t$68.50");

do
{
Console.WriteLine("selecciones opcion");
opcion = int.Parse(Console.ReadLine());

switch (opcion)
{
case 1:
Console.Write("cantidad de bolsas de mano: ");
bm = int.Parse(Console.ReadLine());
valor=valor+bm*28.50;


break;
case 2:
Console.Write("cantidad camisas: ");
camisa=int.Parse(Console.ReadLine());
valor=valor+camisa*45.0;
break;
case 3:
Console.Write("cantidad Tenis: ");
tenis=int.Parse(Console.ReadLine());
valor=valor+tenis*99.0;
break;
case 4:
Console.Write("cantidad ToallasM: ");
toallaM=int.Parse(Console.ReadLine());
valor=valor+toallaM*49.99;
break;
case 5:
Console.Write("cantidad Pantalones: ");
pantalon=int.Parse(Console.ReadLine());
valor=valor+pantalon*45.0;
break;
}
Console.WriteLine("desea agregar otro producto 1=si , 0= calculo de factura ");
continuar=int.Parse(Console.ReadLine());

}

while (continuar == 1);
Console.WriteLine("cantidad Producto subtotal");
if (bm > 0)
{
Console.WriteLine("{0}\t\bolsa de mano\t\t{1}", bm, bm * 28.50);
}
if (camisa > 0)
{
Console.WriteLine("{0}\tcamisa\t\t{1}",camisa, camisa * 45.0);
}
if (tenis > 0)
{
Console.WriteLine("{0}\ttenis\t\t{1}", tenis, tenis * 99.0);
}
if (toallaM > 0)
{
Console.WriteLine("{0}\ttoalla M\t\t{1}", toallaM, toallaM * 49.99);
}
if (pantalon > 0)
{
Console.WriteLine("{0}\tpantalon\t\t{1}", pantalon, pantalon * 68.50);
}
Console.WriteLine("\t\t\t\tSubtotal={0}", valor);
Console.WriteLine("\t\t\t\tIva(11%)={0}", valor * .11);
Console.WriteLine("\t\t\t\ttotal={0}", valor * 1.11);
Console.ReadKey();

}
}

Practica 7_2 Pseudocodigo
Declarar variables
int opcion;
double bm=0;
double camisa = 0;
double tenis = 0;
double toallaM = 0;
double pantalon = 0;
double valor= 0;
int continuar = 1;
Print"Numero de producto Descripcion Precio de lista";
Print "1 Bolsa de mano t$28.50\n2\t\t\tCamisa\t\t$45.0\n3\t\t\tTenis\t\t$99.0\n4\t\t\tToalla M\t$49.99\n5\t\t\tPantalon\t$68.50";

do
{
Print"selecciones opcion";
Read opcion

switch (opcion)
{
case 1:
Print"cantidad de bolsas de mano: ";
Read bm ;
valor=valor+bm*28.50;


break;
case 2:
Print"cantidad camisas: ";
Read camisa;
valor=valor+camisa*45.0;
break;
case 3:
Print"cantidad Tenis: ";
Read tenis;
valor=valor+tenis*99.0;
break;
case 4:
Print"cantidad ToallasM: ";
Read toallaM;
valor=valor+toallaM*49.99;
break;
case 5:
Print"cantidad Pantalones: ");
pantalon=int.Parse(Console.ReadLine());
valor=valor+pantalon*45.0;
break;
}
Print"desea agregar otro producto 1=si , 0= calculo de factura ";
Read continuar

}

while (continuar == 1);
Print"cantidad Producto subtotal";
if (bm > 0)
{
Print("{0}\t\bolsa de mano\t\t{1}", bm, bm * 28.50);
}
if (camisa > 0)
{
Print("{0}\tcamisa\t\t{1}",camisa, camisa * 45.0);
}
if (tenis > 0)
{
Print("{0}\ttenis\t\t{1}", tenis, tenis * 99.0);
}
if (toallaM > 0)
{
Print("{0}\ttoalla M\t\t{1}", toallaM, toallaM * 49.99);
}
if (pantalon > 0)
{
Print("{0}\tpantalon\t\t{1}", pantalon, pantalon * 68.50);
}
Print("\t\t\t\tSubtotal={0}", valor);
("\t\t\t\tIva(11%)={0}", valor * .11);
Print("\t\t\t\ttotal={0}", valor * 1.11);
Practica 7_2visual
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
{
bolsa bm;
camisa cm;
pantalon pt;
tenis tn;
toalla tm;
public Form1()
{
InitializeComponent();
bm = new bolsa();
cm = new camisa();
pt = new pantalon();
tn = new tenis();
tm = new toalla();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
bm.Show();
}

private void button2_Click(object sender, EventArgs e)
{
cm.Show();
}

private void button3_Click(object sender, EventArgs e)
{
tn.Show();
}

private void button4_Click(object sender, EventArgs e)
{
tm.Show();
}

private void button5_Click(object sender, EventArgs e)
{
pt.Show();
}

private void button6_Click(object sender, EventArgs e)
{
if (bm.b > 0)
{
listBox1.Items.Add("bolsa de mano " + bm.total);

}
if (cm.b> 0)
{
listBox1.Items.Add("camisa " + cm.total);
}
if (tn.b > 0)
{
listBox1.Items.Add("tenis " + tn.total);
}
if (tm.b > 0)
{
listBox1.Items.Add("toalla " + cm.total);
}

}
}
}
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 bolsa : Form
{
public double total, b;
public bolsa()
{
InitializeComponent();
b = total = 0;
}

private void button1_Click(object sender, EventArgs e)
{
b = double.Parse(textBox1.Text);
total = total + (b * 28.50);
label2.Text = "total" +total;
}

private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
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 camisa : Form
{
public double total, b;
public camisa()
{
InitializeComponent();
b = total = 0;
}

private void button1_Click(object sender, EventArgs e)
{
b = double.Parse(textBox1.Text);
total = total + (b * 45.00);
label2.Text = "total" + total;
}

private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
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 camisa : Form
{
public double total, b;
public camisa()
{
InitializeComponent();
b = total = 0;
}

private void button1_Click(object sender, EventArgs e)
{
b = double.Parse(textBox1.Text);
total = total + (b * 45.00);
label2.Text = "total" + total;
}

private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}

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
{
bolsa bm;
camisa cm;
pantalon pt;
tenis tn;
toalla tm;
public Form1()
{
InitializeComponent();
bm = new bolsa();
cm = new camisa();
pt = new pantalon();
tn = new tenis();
tm = new toalla();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
bm.Show();
}

private void button2_Click(object sender, EventArgs e)
{
cm.Show();
}

private void button3_Click(object sender, EventArgs e)
{
tn.Show();
}

private void button4_Click(object sender, EventArgs e)
{
tm.Show();
}

private void button5_Click(object sender, EventArgs e)
{
pt.Show();
}

private void button6_Click(object sender, EventArgs e)
{
if (bm.b > 0)
{
listBox1.Items.Add("bolsa de mano " + bm.total);

}
if (cm.b> 0)
{
listBox1.Items.Add("camisa " + cm.total);
}
if (tn.b > 0)
{
listBox1.Items.Add("tenis " + tn.total);
}
if (tm.b > 0)
{
listBox1.Items.Add("toalla " + cm.total);
}

}
}
}


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 pantalon : Form
{

public double total, b;
public pantalon()
{
InitializeComponent();
b = total = 0;
}

private void label1_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
b = double.Parse(textBox1.Text);
total = total + (b * 68.50);
label2.Text = "total" + total;
}
}
}

sing 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 tenis : Form
{
public double total, b;
public tenis()
{
InitializeComponent();
b = total = 0;
}

private void button1_Click(object sender, EventArgs e)
{
b = double.Parse(textBox1.Text);
total = total + (b * 99.00);
label2.Text = "total" + total;
}

private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}






Practica 7_3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace practica_7_problema_3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Serie = 1 + 1.0/2.0 + 1.0/4.0 + 1.0/6.0 + 1.0");
double serie = 1;
int contador = 1;
double denominador = 0.0;
Console.Write("serie= 1+/t");
while (contador < denominador =" denominador" serie =" serie" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdWaA0Qkk84XiUvLuX-RQdCxOi0gUgE51AM9HOscY8zx3zR022IOxuf2nQlPPpCEcLDdZ2b_3FkpJ-XoqC1LqNsiWETAgB_rVNOn6zNf1Rq2NqLLmg-qq7bo_zP-q3enL2LNnWJt87kBII/s1600/7_3c.bmp">
Practica 7_3visual
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 Practica7_3
{
public partial class Form1 : Form
{
double serie ;
int contador ;
double denominador;

public Form1()
{
InitializeComponent();
double serie = 1;
int contador = 1;
double denominador = 0.0;

}

private void button1_Click(object sender, EventArgs e)
{
while (contador < 20)
{
denominador = denominador + 2.0;
listBox1.Items.Add(+denominador);
serie = serie + 1.0 / denominador;
contador++;
}
listBox1.Items.Add("serie"+serie);

}
}
}




Practica 7_3 Pseudocodigo
Print"Serie = 1 + 1.0/2.0 + 1.0/4.0 + 1.0/6.0 + 1.0";
double serie = 1;
int contador = 1;
double denominador = 0.0;
Print("serie= 1+/t");
while (contador < denominador =" denominador" serie =" serie" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 197px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdWaA0Qkk84XiUvLuX-RQdCxOi0gUgE51AM9HOscY8zx3zR022IOxuf2nQlPPpCEcLDdZ2b_3FkpJ-XoqC1LqNsiWETAgB_rVNOn6zNf1Rq2NqLLmg-qq7bo_zP-q3enL2LNnWJt87kBII/s400/7_3c.bmp" alt="" id="BLOGGER_PHOTO_ID_5452312363074878930" border="0">

No hay comentarios:

Publicar un comentario