Está en la página 1de 8

Fecha: 9-4-2023

HAGA LA PRACTICA DE LA PAGINA 38 DEL LIBRO DE


INTRODUCCION A LA PROGRAMAACION 

Nombre: Geuri Bienvenido.

Apellido: Dolsime Martinez.

Matricula: 22-sism-6-058.

Asignatura: Iniciacion a la programacion

Seccion: 102 (IS).

Profesor: Frank Fernando Reyes


INTRODUCCION A LA PROGRAMACION.
Planteamiento de caso
La empresa CONSORCIO REYES hace un descuento de un 20% del subtotal de la venta a los clientes que tengan
categoría 1. Este descuento se aplica antes de calcular el ITBIS. Se requiere un diagrama de flujo y un
programa que calcule el SUBTOTAL, el DESCUENTO, el ITBIS y el TOTAL y luego muestre por pantalla e
imprima la factura. Deberá especificarse todas las variables, luego describir las variables de entrada, las
variables de salida y las fórmulas antes de hacer el diagrama de flujo. Haga también la prueba de escritorio .

Análisis de problema
Variable por utilizar Variable de salida.

Variable de entada.  Descuento


 Subtotal
 Articulo.
 ITBIS
 Categoría
 Total
 Cantidad.
 Precio. Formula.
 Subtotal = cantidad * precio
 Descuento = subtotal * 0.20=5 * 20 = 100
 ITBIS = (subtotal - descuento) * 0.18
 Total = (Subtotal - descuento) + ITBIS
DIAGRAMA DE FLUJO.
Imports System End Try MsgBox("Debe de introducir un valor
numerico, intentelo de nuevo, pulsar aceptar
Module Program vuelve1: continuar")

Sub Main(args As String()) Try Console.Clear()

'DECLARAMOS LAS VARIABLES Console.WriteLine("Introducir la Categoria") GoTo vuelve2

Dim Articulo As String Categoria = Console.ReadLine End Try

Dim Categoria, Precio, Cantidad, Descuento, Console.WriteLine() vuelve3:


Subtotal, ITBIS, Total As Double
Catch Try
'ENTRADA DE DATOS
MsgBox("Debe introducir un valor numerico, Console.WriteLine("Introducir la Cantidad")
vuelve: intente de nuevo, pulsa aceptar para continuar")
Cantidad = Console.ReadLine
Try Console.Clear()
Console.WriteLine()
Console.Write("Introducir el Articulo: ") GoTo vuelve1
Catch
Articulo = Console.ReadLine() End Try
MsgBox("Debe introducir un valor numerico,
Console.WriteLine() vuelve2: intentelo de nuevo, pulsar aceptar")

Catch Try Console.Clear()

MsgBox("Dede introducir un valor numerico, Console.WriteLine("Introducir el Precio") GoTo vuelve3


intente de nuevo, Pulsa aceptar para continuar ")
Precio = Console.ReadLine End Try
Console.Clear()
Console.WriteLine() vuelve4:
GoTo vuelve
Catch Try

Console.WriteLine("Introducir el Descuento")
Descuento = Console.ReadLine Try GoTo vuelve7

Console.WriteLine() Console.WriteLine("Introducir ITBIS") End Try

Catch ITBIS = Console.ReadLine 'CALCULAR EL DESCUENTO

MsgBox("Debe introducir un valor numerico, Console.WriteLine() Subtotal = Cantidad * Precio


intente de nuevo, pulsar aceptar")
Catch Descuento = Subtotal * 0.2
GoTo vuelve4
MsgBox("Debe introducir un valor numerico, ITBIS = (Subtotal - Descuento) * 0.18
End Try intente de nuevo, pulse aceptar")
Total = (Subtotal - Descuento) + ITBIS
vuelve5: Console.Clear()
'IMPRIMIMOS LOS RESULTADOS
Try GoTo vuelve6
Console.WriteLine("SU FACTURA.")
Console.WriteLine("Introducir el Subtotal") End Try
Console.WriteLine()
Subtotal = Console.ReadLine vuelve7:
Console.WriteLine()
Console.WriteLine() Try
Console.WriteLine("Articulo:" & Articulo)
Catch Console.WriteLine("Introducir el Total")
Console.WriteLine()
MsgBox("Debe introducir un valor numerico, Total = Console.ReadLine
intente de nuevo, pulsar aceptar") Console.WriteLine()
Console.WriteLine()
Console.Clear() Console.WriteLine("Categoria:" & Categoria)
Catch
GoTo vuelve5 Console.WriteLine()
MsgBox("Debe introducir un valor numerico,
End Try intente de nuevo, pulse aceptar") Console.WriteLine()

vuelve6: Console.Clear() Console.WriteLine("Precio:" & Precio)


Console.WriteLine() Console.WriteLine() Console.WriteLine("Total:" & Total)

Console.WriteLine() Console.WriteLine("Subtotal:" & Subtotal) 'FIN

Console.WriteLine("Cantidad:" & Cantidad) Console.WriteLine() End Sub

Console.WriteLine() Console.WriteLine() End Module

Console.WriteLine() Console.WriteLine("ITBIS:" & ITBIS)

Console.WriteLine("Descuento:" & Descuento) Console.WriteLine()

Console.WriteLine() Console.WriteLine()

También podría gustarte