Develop a solution to compute the average price for three items’ price input by user one at a time. If the average price is greater than RM50, 10% discount will be given to the customer. Your program should be able to display the nett amount that needs to be paid by that customer.
Imports System.IO
Module Module1
Sub Main()
Dim sumPrice As Double = 0
For i As Integer = 0 To 2
Console.Write("Enter the price for item {0}: ", (i + 1))
Dim price As Double = Double.Parse(Console.ReadLine())
sumPrice += price
Next
Dim averagePrice As Double = sumPrice / 3.0
Dim discount As Double
If averagePrice > 50 Then
discount = sumPrice * 0.1
Console.WriteLine("10% discount: {0}", discount)
End If
sumPrice -= discount
Console.WriteLine("The nett amount: {0}", sumPrice)
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment