# 2.10.jl # 2023-01-08 # $Id: 2.10.jl 1.1 2023/01/08 04:52:10 s Exp $ # bp, Baresls produced 生産量 # gr, Gross revenue 総収入 # ni, Net income 正味収益 # op1, Option1 選択肢1 # op2, Option2 選択肢2 # da, Depletion allowance 減耗控除 # ti, Taxable income 課税対象収益 # tr, tax rate 税率 # tax, 税金 # ai, After-tax income 税引き後収益 using Printf # input n = 5 tr = 0.45 bp =[ 80e3, 70e3, 50e3, 30e3, 10e3] gr =[1600e3, 1400e3, 1000e3, 600e3, 200e3] ni =[1200e3, 1000e3, 500e3, 200e3, 50e3] # calculating op1 = min.(gr*0.22, ni*0.5) op2 = bp .* 5 da = max.(op1, op2) ti = ni .- da tax = ti .* tr ai = ni .- tax # output @printf("%3s%8s%8s%8s%8s%8s%8s%8s%8s%8s\n", "y", "bp", "gr", "ni", "opt1", "otp2", "da", "ti", "tax", "ai") println(repeat("-", 75)) for i = 1:n @printf("%3d%8.0f%8.0f%8.0f%8.0f%8.0f%8.0f%8.0f%8.0f%8.0f\n", i, bp[i], gr[i], ni[i], op1[i], op2[i], da[i], ti[i], tax[i], ai[i]) end println(repeat("-", 75)) @printf("%43s%8.0f\n", "sum of da=", sum(da)) # end