-
Lenguaje
Visual Basic .Net
-
Descripción
Dado el monto de una compra calcular el descuento considerado:
- Descuento es 10% si el monto es mayor a 100.
- Descuento es 20% si el monto es mayor a 50 y menor o igual a 100.
- No hay descuento si el monto es menor o igual a $50.
Imprimir total a pagar de cada persona.
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
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 DescuentoPorUnaCompra
Sub Main()
Dim descuento, monto, total_a_pagar As Double
Dim tecla_repetir As Char
Do
Console.Clear()
Console.Write("Ingresa el valor de monto: ")
monto = Double.Parse(Console.ReadLine())
descuento=0
If monto>=50 And monto<100 Then
descuento=monto*0.2
End If
If monto>100 Then
descuento=monto*0.1
End If
total_a_pagar=monto-descuento
Console.WriteLine("Valor de descuento: " & descuento)
Console.WriteLine("Valor de total a pagar: " & total_a_pagar)
Console.WriteLine()
Console.Write(ChrW(&HBF) & "Deseas repetir el proceso? (S/N): ")
Do
tecla_repetir = Console.ReadKey(True).KeyChar
Loop While tecla_repetir <> "s" And tecla_repetir <> "n" And tecla_repetir <> "S" And tecla_repetir <> "N"
Loop While tecla_repetir = "s" Or tecla_repetir = "S"
End Sub
End Module
Sub Main()
Dim descuento, monto, total_a_pagar As Double
Dim tecla_repetir As Char
Do
Console.Clear()
Console.Write("Ingresa el valor de monto: ")
monto = Double.Parse(Console.ReadLine())
descuento=0
If monto>=50 And monto<100 Then
descuento=monto*0.2
End If
If monto>100 Then
descuento=monto*0.1
End If
total_a_pagar=monto-descuento
Console.WriteLine("Valor de descuento: " & descuento)
Console.WriteLine("Valor de total a pagar: " & total_a_pagar)
Console.WriteLine()
Console.Write(ChrW(&HBF) & "Deseas repetir el proceso? (S/N): ")
Do
tecla_repetir = Console.ReadKey(True).KeyChar
Loop While tecla_repetir <> "s" And tecla_repetir <> "n" And tecla_repetir <> "S" And tecla_repetir <> "N"
Loop While tecla_repetir = "s" Or tecla_repetir = "S"
End Sub
End Module