--- title: 筆記-電費計算 categories: 筆記 date: 2017-08-22 17:30:46 tags: [筆記] --- ```ASP 電費計算 <% deg = Request.Form("txt1") 'Response.write deg if deg >=0 and deg <=120 then total_cost = deg * 1.63 cal_process = deg & " * 1.63 = " & total_cost Response.write "Degree:" & deg &"

" Response.Write "cal_process:" & cal_process elseif deg >=121 and deg <=330 then total_cost = (120-0)*1.63 + (deg-121)*2.38 cal_process = "(120-0)*1.63 + (" & deg & "-121)*2.38 = " & total_cost Response.write "Degree:" & deg &"

" Response.Write "Non Summer cal_process:" & cal_process Response.write "
Degree Cost sum
0-120 1.63 195.6
" & "" & deg & "" &"(" & deg& "-121)" &" 2.38 " & (deg-121)*2.38 &"
331-500 3.52
501-700 4.61
701-1000 5.42
1001~6.13
degtotal" & total_cost & "
" total_cost = (120-0)*1.63 + (deg-121)*2.10 cal_process = "(120-0)*1.63 + (" & deg & "-121)*2.10 = " & total_cost Response.write "Degree:" & deg &"

" Response.Write "cal_process:" & cal_process Response.write "
Degree Cost sum
0-120 1.63 195.6
" & "" & deg & "" &"(" & deg& "-121)" &" 2.10 " & (deg-121)*2.10 &"
331-500 2.89
501-700 3.79
701-1000 4.42
1001~4.83
degtotal" & total_cost & "
" elseif deg >=331 and deg <=500 then total_cost = (120-0)*1.63 + (330-121)*2.38 + (deg-331)*3.52 cal_process = "(120-0)*1.63 + (330-121)*2.38 + (" & deg & "-331)*3.52 = " & total_cost Response.write "Degree:" & deg &"

" Response.Write "cal_process:" & cal_process Response.write "
Degree Cost sum
0-120 1.63 195.6
121-3302.38497.42
" & "" & deg & "" &"(" & deg & "-331) 3.52 "&(deg-331)*3.52 &"
501-700 4.61
701-1000 5.42
1001~6.13
degtotal" & total_cost & "
" total_cost = (120-0)*1.63 + (330-121)*2.10 + (deg-331)*2.89 cal_process = "(120-0)*1.63 + (330-121)*2.10 + (" & deg & "-331)*2.89 = " & total_cost Response.write "Degree:" & deg &"

" Response.Write "Non Summer cal_process:" & cal_process Response.write "
Degree Cost sum
0-120 1.63 195.6
121-3302.10497.42
" & "" & deg & "" &"(" & deg & "-331) 2.89 "&(deg-331)*2.89 &"
501-700 3.79
701-1000 4.42
1001~4.83
degtotal" & total_cost & "
" elseif deg >=501 and deg <=700 then total_cost = (120-0)*1.63 + (330-121)*2.38 + (500-331)*3.52 + (deg-501)*4.61 cal_process = "(120-0)*1.63 + (330-121)*2.38 + (500-331)*3.52 + (" & deg & "-501)*4.61=" & total_cost & "

" Response.write "Degree:" & deg &"

" Response.Write "cal_process:" & cal_process Response.write "
Degree Cost sum
0-120 1.63 195.6
121-3302.38497.42
331-500 3.52 594.88
" & "" & deg & "" &"(" & deg &"-501) 4.61 " & (deg-501)*4.61&"
701-1000 5.42
1001~6.13
degtotal" & total_cost & "
" total_cost = (120-0)*1.63 + (330-121)*2.10 + (500-331)*2.89 + (deg-501)*3.79 cal_process = "(120-0)*1.63 + (330-121)*2.10 + (500-331)*2.89 + (" & deg & "-501)*3.79=" & total_cost & "

" Response.write "Degree:" & deg &"

" Response.Write "Non Summer cal_process:" & cal_process Response.write "
Degree Cost sum
0-120 1.63 195.6
121-3302.10497.42
331-500 2.89 594.88
" & "" & deg & "" &"(" & deg &"-501) 3.79 " & (deg-501)*3.79&"
701-1000 4.42
1001~4.83
degtotal" & total_cost & "
" elseif deg >=701 and deg <=1000 then total_cost = (120-0)*1.63 + (330-121)*2.38 + (500-331)*3.52 + (700-501)*4.61 + (deg-701)*5.42 cal_process = "(120-0)*1.63 + (330-121)*2.38 + (500-331)*3.52 + (700-501)*4.61 + (" & deg & "-701)*5.42 = " & total_cost & "

" Response.write "Degree:" & deg &"

" Response.Write "cal_process:" & cal_process Response.write "
Degree Cost sum
0-120 1.63 195.6
121-3302.38497.42
331-500 3.52 594.88
501-700 4.61 917.39
" & "" & deg & "" & "(" & deg &"-701) 5.42 " & (deg-701)*5.42 &"
1001~6.13
degtotal" & total_cost & "
" total_cost = (120-0)*1.63 + (330-121)*2.10 + (500-331)*2.89 + (700-501)*3.79 + (deg-701)*4.42 cal_process = "(120-0)*1.63 + (330-121)*2.10 + (500-331)*2.89 + (700-501)*3.79 + (" & deg & "-701)*4.42 = " & total_cost & "

" Response.write "Degree:" & deg &"

" Response.Write "Non Summer cal_process:" & cal_process Response.write "
Degree Cost sum
0-120 1.63 195.6
121-3302.10497.42
331-500 2.89 594.88
501-700 3.79 917.39
" & "" & deg & "" & "(" & deg &"-701) 4.42 " & (deg-701)*4.42 &"
1001~4.83
degtotal" & total_cost & "
" elseif deg >=1001 then total_cost = (120-0)*1.63 + (330-121)*2.38 + (500-331)*3.52 + (700-501)*4.61 + (1000-701)*5.42 + (deg-1001)*6.13 cal_process = "(120-0)*1.63 + (330-121)*2.38 + (500-331)*3.52 + (700-501)*4.61 + (1000-701)*5.42 + (" & deg & "-1001)*6.13 = " & total_cost & "

" Response.write "Degree:" & deg &"

" Response.Write "cal_process:" & cal_process Response.write "
Degree Cost sum
0-120 1.63 195.6
121-3302.38497.42
331-500 3.52 594.88
501-700 4.61 917.39
701-1000 5.42 1620.58
" & "" & deg & "" &"(" & deg &"-1001)" & "6.13 " & (deg-1001)*6.13 & "
degtotal" & total_cost & "
" total_cost = (120-0)*1.63 + (330-121)*2.10 + (500-331)*2.89 + (700-501)*3.79 + (1000-701)*4.42 + (deg-1001)*4.83 cal_process = "(120-0)*1.63 + (330-121)*2.10 + (500-331)*2.89 + (700-501)*3.79 + (1000-701)*4.42 + (" & deg & "-1001)*4.83 = " & total_cost & "

" Response.write "Degree:" & deg &"

" Response.Write "Non Summer cal_process:" & cal_process Response.write "
Degree Cost sum
0-120 1.63 195.6
121-3302.10497.42
331-500 2.89 594.88
501-700 3.79 917.39
701-1000 4.42 1620.58
" & "" & deg & "" &"(" & deg &"-1001)" & "4.83 " & (deg-1001)*4.83 & "
degtotal" & total_cost & "
" end if %> ``` 運算結果 ![](https://i.imgur.com/KMI7UYY.png)