Está en la página 1de 4

Diagrama de flujo

Inicio

Ingresar
base

Ingresar
altura

Área =
(base*altu

Ver
resultado

Fin
Inicio

Compra de productos

Lácteos, embutidos,
frutas y vegetales

Seleccionar producto

Total de la compra

Fin
Programa N° 1

Dim TLacteos As Double = 0


Dim Tembutidos As Double = 0
Dim Tfrutas As Double = 0
Dim Tvegetales As Double = 0
Dim Total As Double = 0
Dim ProductoA As String = "Lacteos"
Dim ProductoB As String = "Embutidos"
Dim ProductoC As String = "Frutas"
Dim ProductoD As String = "Vegetales"
Dim fila As DataGridViewRow = New DataGridViewRow()

For Each fila In ListadeProductosDataGridView.Rows()

Select Case fila.Cells("DataGridViewTextBoxColumn3").Value


Case Is = ProductoA
TLacteos +=
Convert.ToDouble(fila.Cells("DataGridViewTextBoxColumn4").Value)

Case Is = ProductoB
Tembutidos +=
Convert.ToDouble(fila.Cells("DataGridViewTextBoxColumn4").Value)

Case Is = ProductoC
Tfrutas +=
Convert.ToDouble(fila.Cells("DataGridViewTextBoxColumn4").Value)

Case Is = ProductoD
Tvegetales +=
Convert.ToDouble(fila.Cells("DataGridViewTextBoxColumn4").Value)

End Select

Total += Convert.ToDouble(fila.Cells("DataGridViewTextBoxColumn4").Value)

Next
TextBox1.Text = Convert.ToString(TLacteos)
TextBox2.Text = Convert.ToString(Tembutidos)
TextBox3.Text = Convert.ToString(Tfrutas)
TextBox4.Text = Convert.ToString(Tvegetales)
TextBox5.Text = Convert.ToString(Total)
End Sub
Programa N°2
Dim base, altura, radio, lado, n, a, area As Double
Dim Fig_Geo As String
Dim Pi As Double = 3.1416

Fig_Geo = TextBox1.Text

If (TextBox1.Text = " Tríangulo" = True Then


base = InputBox("Ingrese la medida de la base: ", "Entrada de datos")
altura = InputBox("Ingrese la medida de la altura:", "Entrada de datos")
area = (base * altura) / 2
TextBox2.Text = area
End If

If (TextBox1.Text = "Cuadrado") = True Then


lado = InputBox("Ingrese la medida de los lados:", "Entrada de datos")
area = lado * lado
TextBox2.Text = area
End If

If (TextBox1.Text = "Círculo") = True Then


radio = InputBox("Ingrese el radio:", "Entrada de datos")
area = 2 * Pi * radio ^ 2
TextBox2.Text = area
End If

If (TextBox1.Text = "Rectángulo") = True Then


base = InputBox("Ingrese la medida de la base:", "Entrada de datos")
altura = InputBox("Ingrese la medida de la altura:", "Entrada de datos")
area = base * altura
TextBox2.Text = area
End If

If (TextBox1.Text = "Polígono") = True Then


n = InputBox("Ingrese la cantidad de lados:", "Entrada de datos")
lado = InputBox("Ingrese la medida de los lados:", "Entrada de datos")
a = InputBox("Ingrese la medidad del apotema en:", "Entrada de datos")
area = (n * lado * a) / 2
TextBox2.Text = area
End If

Nayelis Batista 8-967-904


Karen Muñoz 8-947-682
Grupo: 1IB-121

También podría gustarte