语法到底错在那里?

来源:百度知道 编辑:UC知道 时间:2024/05/31 16:34:14
按照下面的设定写一个程序,计算将所给定重量的物品运送到指定路程长度的地方所需要的运费金额。

1公斤以下 30公里以内 0.5元/公斤/公里 30到50公里内 1元/公斤/公里 50到300公里内 1.5元/公斤/公里 300公里以上 0.3元/公斤/公里

1公斤至15公斤 30公里以内 1元/公斤/公里 30到50公里内 2元/公斤/公里 50到300公里内 3元/公斤/公里 300公里以上 1.5元/公斤/公里

15公斤以上 30公里以内 2元/公斤/公里 30到50公里内 4元/公斤/公里 50到300公里内 6元/公斤/公里 300公里以上 2元/公斤/公里

<%
a=62
b=46
if a<1 and a>0 and b<30 and b>0 then
response.Write(a*b*0.5)
else
if
a<1 and a>0 and b>=30 and b<50 then
response.Write(a*b*1)
else
if a<1 and a>0 and b>=50 and b<300 then
response.Write(a*b*1.5)
else
if a<1 and a>0 and b>=300 then
response.Write(a*b*0.3)
else
if a>=1 and a<=15 and b<30 and b>0 then
response.Write(a*b*1)
else
if a>=1 and a<=15 and b>=30 and b<50 then
response.Write(a*b*2)
else
if a>=1 and a<=15 and b>=50 and b<300 then
respon

改为这样:
a=62
b=46
if a<1 and a>0 and b<30 and b>0 then
response.Write(a*b*0.5)
elseif a<1 and a>0 and b>=30 and b<50 then
response.Write(a*b*1)
elseif a<1 and a>0 and b>=50 and b<300 then
response.Write(a*b*1.5)
elseif a<1 and a>0 and b>=300 then
response.Write(a*b*0.3)
elseif a>=1 and a<=15 and b<30 and b>0 then
response.Write(a*b*1)
elseif a>=1 and a<=15 and b>=30 and b<50 then
response.Write(a*b*2)
elseif a>=1 and a<=15 and b>=50 and b<300 then
response.Write(a*b*3)
elseif a>=1 and a<=15 and b>=300 then
response.Write(a*b*1.5)
elseif a>15 and b<30 and b>0 then
response.Write(a*b*2)
elseif a>15 and b>=30 and b<50 then
response.Write(a*b*4)
elseif a>15 and b>=50 and b<300 then
response.Write(a*b*6)
else
response.writ