Similar to a previous problem using trailer record logic that was posted I am also struggling to get my code to work. I am supposed to output the customers name and how much their change is, item cost, number of quarters, dimes, nickles, and pennies.
This is the code that I have so far, please help me?
Sub Main()
' variables for storing user input
Dim cname As String
Dim itemcost As Decimal
' variables for storing cosole output
Dim change As Double
Dim tempchange As Double
Dim count1 As Integer = 0
Dim count2 As Integer = 0
Dim count3 As Integer = 0
Dim count4 As Integer = 0
change = tempchange
tempchange = 0
' get input from user
Console.WriteLine("Please enter the Customer(s) name ")
Console.WriteLine("Please enter the itemcost ")
cname = Console.ReadLine()
itemcost = Console.ReadLine()
'converting change due from item cost
If itemcost <= 0 Then
Write("No Input ")
Console.WriteLine("Press enter to continue.")
Console.ReadLine()
Else
Do While itemcost > 0
change = 1 - itemcost
Do While tempchange >= 0.25
tempchange = tempchange - 0.25
count1 = count1 + 1
Loop
Do While tempchange >= 0.1
tempchange = tempchange - 0.1
count2 = count2 + 1
Loop
Do While tempchange >= 0.05
tempchange = tempchange - 0.05
count3 = count3 + 1
Loop
Do While tempchange >= 0.01
tempchange = tempchange - 0.01
count4 = count4 + 1
Loop
' display results
Console.WriteLine("The customer's name is")
Console.WriteLine("The itemcost is")
Console.WriteLine("The change is")
Console.WriteLine("Quarter(s) {0}", count1)
Console.WriteLine("Dime(s) {1}", count2)
Console.WriteLine("Nickle(s) {2}", count3)
Console.WriteLine("Penny(s) {3}", count4)
'prevents window from closing
Console.ReadLine()
Loop
End If
End Sub
End Module