• Lenguaje

    Visual Basic .Net

  • Descripción

    Lea el precio de un artículo y la cantidad comprada, para calcular el importe y un descuento del 25% si la cantidad comprada es mayor o igual a 100. Al final el programa debe mostrar importe sin descuento, descuento el importe total sin descuento y el cambio.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Module CalcularDescuento

    Sub Main()
        Dim cambio, cantidad, descuento, importe, importetot As Double
        Dim pago, precio As Double
        Console.Write("Ingresa el valor de cantidad: ")
        cantidad = Double.Parse(Console.ReadLine())
        Console.Write("Ingresa el valor de pago: ")
        pago = Double.Parse(Console.ReadLine())
        Console.Write("Ingresa el valor de precio: ")
        precio = Double.Parse(Console.ReadLine())
        importe=precio*cantidad
        If cantidad>=100 Then
            descuento=importe*0.25
        Else
            descuento=0
        End If
        importetot=importe-descuento
        cambio=pago-importetot
        Console.WriteLine("Valor de cambio: " & cambio)
        Console.WriteLine("Valor de descuento: " & descuento)
        Console.WriteLine("Valor de importe: " & importe)
        Console.WriteLine("Valor de importetot: " & importetot)
        Console.WriteLine()
        Shell ("cmd /c pause", AppWinStyle.NormalFocus, True)
    End Sub

End Module