1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| package main
import ( "fmt" "strconv" )
var months = [12]string{"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"}
func main(){ basic := 5000.0 fiveOne := *** add := 1500.0 other := 0.0
all := ***
totalTax := 0.0
i:=1.0 for i<13{ this := i*(all - basic - fiveOne - add - other)
taxLv := 0.0 taxNum := 0.0 if this<=36000{ taxLv = 0.03 taxNum = 0.0 }else if this<=144000{ taxLv = 0.1 taxNum = 2520.0 }else if this<=300000{ taxLv = 0.2 taxNum = 16920.0 }else if this<=420000{ taxLv = 0.25 taxNum = 31920.0 }else if this<=660000{ taxLv = 0.3 taxNum = 52920.0 }else if this<=960000{ taxLv = 0.35 taxNum = 85920.0 }else{ taxLv = 0.45 taxNum = 181920.0 }
now := this*taxLv - totalTax - taxNum totalTax += now fmt.Println(months[int(i-1)]+":"+strconv.FormatFloat(now, 'f', 2, 64))
i = i+1 }
fmt.Println("totalTax:"+strconv.FormatFloat(totalTax, 'f', 2, 64)) }
|