所以这段代码似乎可以很好地完成我被要求做的事情,但我觉得一团糟,想找出清理它的方法,没有什么需要高级的,可能只是一个 for 循环或 if 语句,甚至可能for 循环增强甚至是数组。我觉得这段代码太长而且太乱,有点像 spheggti 代码
这是我参加的计算机科学课的内容。 这是说明。
Write a program that computes taxes due for a person with a filing status of single. Include deductions, exemptions, and credits. Apply the tax rate to the income after applying the deductions and exemptions. Then subtract credits from the tax due to get the final tax amount due. Expected output sample is provided below. Name your class TaxReturn. Income: $85,500 Deductions: $23,753 Exemptions: $15,200
应税收入:$46,547
税费:$ 7,667 减去积分 $ 5,000
应缴税款:2,667 美元
• 豁免 = 豁免数量 X $3,800 • 应税收入 = 收入 – 扣除 – 豁免 • 税额(见下图) • 应缴税款 =
block 引用>
最佳答案
您可以开始使用“taxBoundaries”类来保存有关税收类别(富人、非富人等)的信息,并编写一个方法,以给定收入作为输入,检索正确的税率和税收边界
关于Java税类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16992906/