我正在为 Visual Basic 编写这个程序,它将根据用水量确定账单。我的问题是我输入的所有值在命令提示符中都返回为零。谁能解释这段代码有什么问题?
Option Explicit On
Option Strict On
Imports System
module eurekawatercompany
Sub Main ()
' Declare variables of problem
Dim waterusage as double
Dim totalcharge as double
' Prompts for user to enter their water usage.
Console.write ("Please enter your current water usage (cubic feet): ")
waterusage = convert.toint32(console.readline())
If (waterusage < 1000) then
totalcharge = 15
End If
If (1000 > waterusage) and (waterusage < 2000) then
totalcharge = 0.0175 * waterusage + 15
End If
else if (2000 < waterusage) and (waterusage > 3000) then
totalcharge = 0.02 * waterusage + 32.5
End If
' 32.5 is the price of exactly 2000cm^(3) of water
else if (waterusage > 3000) then
totalcharge = 70
End If
Console.out.writeline ("Total charge is: ")
Console.out.writeline (totalcharge)
End sub
End Module