Discuss / Java / 计算税和

计算税和

Topic source

刘晋呈php

#1 Created at ... [Delete] [Delete and Lock User]
public class Main 
{

    public static void main(String[] args) 
    {
        // TODO: 给一个有工资收入和稿费收入的小伙伴算税:        
          Income[] incomes = new Income[]
          {
                new Income(3000),
                new SalaryIncome(7500),
                new RoyaltyIncome(15000)
          };
        double total = 0;
        //计算税和        
        for(Income income:incomes)
        {
            total += income.getTax();
        }
        System.out.println(total);
    }
}

  • 1

Reply