I am working on a school project in which we are to make a basic cash register like program which determines the total price of several objects and adds 6 percent tax to specified items. What my problem is whenever it asks if you wish to add tax or not, it ignores if you say "y" for yes and does not add it. Could anyone help with this?
[Code=vb]Module Module1
Sub Main()
Console.WriteLi ne("Welcome to unnamed outdoor gift shop on the Santa Monica Pier.")
Console.ReadLin e()
Dim decScore, decTax, decTotal As Decimal
Dim intItems, intCount As Integer
Dim strNugent As String
Console.WriteLi ne("Enter the number of items")
intItems = Console.ReadLin e()
Do
Console.WriteLi ne("Enter price")
intCount = intCount + 1
decScore = Console.ReadLin e()
decTotal = decTotal + decScore
Console.WriteLi ne("Is it taxable? y/n")
strNugent = Val(Console.Rea dLine())
If strNugent = "y" Then
Console.WriteLi ne("Tax added")
decTax = decTax + (decScore * 0.06)
End If
Loop While (intCount < intItems)
Console.WriteLi ne("Total = " & (decTotal))
Console.WriteLi ne("Press Enter to exit")
Console.ReadLin e()
End Sub
End Module[/CODE]
[Code=vb]Module Module1
Sub Main()
Console.WriteLi ne("Welcome to unnamed outdoor gift shop on the Santa Monica Pier.")
Console.ReadLin e()
Dim decScore, decTax, decTotal As Decimal
Dim intItems, intCount As Integer
Dim strNugent As String
Console.WriteLi ne("Enter the number of items")
intItems = Console.ReadLin e()
Do
Console.WriteLi ne("Enter price")
intCount = intCount + 1
decScore = Console.ReadLin e()
decTotal = decTotal + decScore
Console.WriteLi ne("Is it taxable? y/n")
strNugent = Val(Console.Rea dLine())
If strNugent = "y" Then
Console.WriteLi ne("Tax added")
decTax = decTax + (decScore * 0.06)
End If
Loop While (intCount < intItems)
Console.WriteLi ne("Total = " & (decTotal))
Console.WriteLi ne("Press Enter to exit")
Console.ReadLin e()
End Sub
End Module[/CODE]
Comment