编程作业-价格问题
编程作业-价格问题
Module Module1
Sub Main()
Console.Write("请输入您的金额:")
Dim a As Int32 = Console.ReadLine
Dim b As Int32 '定义两个变量,其中a是输入值
If a < 1000 Then
b = a
ElseIf 1000 <= a And a < 2000 Then
b = a * 0.95
ElseIf 2000 <= a And a < 3000 Then
b = a * 0.9
ElseIf 3000 <= a And a < 5000 Then
b = a * 0.85
ElseIf a >= 5000 Then
b = a * 0.8
End If '定义a的取值范围,以及b的表达式
Console.Write("你的优惠金额是:")
Console.WriteLine(b) '输出
End Sub
End Module
Sub Main()
Console.Write("请输入您的金额:")
Dim a As Int32 = Console.ReadLine
Dim b As Int32 '定义两个变量,其中a是输入值
If a < 1000 Then
b = a
ElseIf 1000 <= a And a < 2000 Then
b = a * 0.95
ElseIf 2000 <= a And a < 3000 Then
b = a * 0.9
ElseIf 3000 <= a And a < 5000 Then
b = a * 0.85
ElseIf a >= 5000 Then
b = a * 0.8
End If '定义a的取值范围,以及b的表达式
Console.Write("你的优惠金额是:")
Console.WriteLine(b) '输出
End Sub
End Module
侯亚朋-07网1- 帖子数 : 2
注册日期 : 08-03-21
您在这个论坛的权限:
您不能在这个论坛回复主题