好的,在这个程序中我做错了什么我的代码没有像它想象的那样出来。我试图搞乱总控制并移动它但我仍然有同样的事情。我只是不知道我搞砸了哪里。
Module Module1
Sub Main()
Dim salesPersonName As String
Dim monthlySales, SalesPersonCommission, salesmancode As Integer
Dim totalSales, totalCommission, commission As Integer
Console.WriteLine("Please enter your name: ")
salesPersonName = Console.ReadLine()
Do While Not (salesPersonName.Equals("Eugene"))
Console.WriteLine("Please enter a sales code: ")
salesmancode = CInt(Console.ReadLine())
Select Case salesmancode
Case 1
SalesPersonCommission = CInt(0.01 * monthlySales + 1000)
Case 2
SalesPersonCommission = CInt(0.03 * monthlySales)
Case 3
SalesPersonCommission = CInt(0.04 * monthlySales + 500)
Case Is < 3
SalesPersonCommission = CInt(0.02 * monthlySales + 200)
End Select
totalCommission = totalCommission + commission
Console.WriteLine("Please enter your name= " & salesPersonName)
Console.WriteLine("Monthly Sales= " & monthlySales)
Console.WriteLine("Sales Code= " & salesmancode)
Console.WriteLine("Sales Person Commission= " & SalesPersonCommission)
Console.WriteLine("Please enter your name:")
salesPersonName = Console.ReadLine()
Loop
Console.WriteLine("Total Commission Dollars= " & monthlySales + totalSales)
End Sub
End Module
代码应该出现:
Name Code MonthlySales Commission
Adam 1 500 1005
Bill 1 2000 1020
Chet 2 3000 90
Doug 3 4000 660
Eve 4 5000 300
Total Monthly Sales: $ 14500
Total CommissionDollars: $ 3075
修改
相反,这是收到的输出:
Name Code MonthlySales Commission
Allen 1 0 1000
答案 0 :(得分:1)
第四种情况是否应大于3而不是少于3(包括所有其他情况)?
Case Is < 3
更改为:
Case Is > 3
答案 1 :(得分:1)
退一步看看你的代码,你在哪里将monthlySales添加到totalSale中?您是否打算打印出月度销售额或每月总销售额?你需要显示你正在计算的totalCommission吗?您是否需要向用户索要monthlySales?我相信你可以通过这个代码。