本文介绍了计算税收,将钱作为c#中的输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写税务计算程序。接受来自用户的资金并使用以下模式计算税额。



Write a program of tax calculation. Accept money as input from the user and calculate the tax using following pattern.

Money                 Percentage      Total Tax
Less than 10,000          5%              ?
10,000 to 100,000         8%              ?
More than 100,000        8.5%             ?

推荐答案


using System;

class Program
{
    static void Main()
    {
       Console.Write("Input money : ");
       double money = double.Parse(Console.ReadLine());
       double tax;
       if (money < 10000)
       {
           tax = .05 * money;
       }
       else if (money <= 100000)
       {
           tax = .08 * money;
       }
       else
       {
           tax = .085 * money;
       }

       Console.WriteLine("Tax is {0:C}", tax);
       Console.ReadKey();
    }
}





[Agent_Spock]

- 添加了Code Brackets



[Agent_Spock]
- Added Code Brackets


这篇关于计算税收,将钱作为c#中的输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 20:07