Published Date : 2021年5月9日5:53

【Android app:Part 16】Android App Calculates Income and Resident Taxes for sole proprietors and salaried workers

This blog has an English translation


This is a summary blog post about a video I uploaded to NicoNico.


Please refer to the video for details.


Table of Contents

① 動画の説明
① Video Description











​The app I'm going to show you for calculating income and residence taxes for salaried workers and Individual employers, etc. is just a simple application for playing.

​Please check the exact number and calculation method by yourself.

​This app is used to calculate rough estimates and enjoy them.

​Do not use for year-end adjustment of employees or for individual tax return.

In addition, the method of calculating taxes and deductions may change.

Also, there is a possibility that the deduction and tax calculation methods are incorrect.

Don't trust it too much, and test it yourself.

​I will not be liable for any damage caused by using this app.


Android App Calculates Income and Resident Taxes for sole proprietors and salaried workers, Part 16.


Continued from last time.


Let's create a set of class files within the package we created in the previous video to calculate various taxes.

Responsive image


However, the code itself is pretty much the same as the one you created in the previous video series, so please watch the video with the intention of reviewing.

Responsive image

public Map<String, String> spVDcasualtyLossDeduction(int cld) {
    spPaymentAmountA = cld;
    spCasualtyLossDeduction = cld;

    int lossAmountComp1 = spCasualtyLossDeduction - (int)(super.getSpProvisionalTaxableIncome() * 0.1);
    int lossAmountComp2 = spCasualtyLossDeduction - 50000;

    if (lossAmountComp1 < lossAmountComp2) {
        spCasualtyLossDeduction = lossAmountComp2;
    if (lossAmountComp1 > lossAmountComp2) {
        spCasualtyLossDeduction = lossAmountComp1;
    if (lossAmountComp1 <= 0 && lossAmountComp2 <= 0) {
        spCasualtyLossDeduction = 0;

    Map<String, String> spCasualtyLossDeductionMap = new HashMap<String, String>() {
            put("雑損控除_所得税", String.format("%,d", spCasualtyLossDeduction));
            put("雑損控除_住民税", String.format("%,d", spCasualtyLossDeduction));
    return spCasualtyLossDeductionMap;

Responsive image

public Map<String, String> spVDmedicalExpenseDeduction(int med) {
    spPaymentAmountB = med;
    spMedicalExpenseDeduction = med;

    if (spMedicalExpenseDeduction <= 100000) {
        spMedicalExpenseDeduction = 0;

    Map<String, String> spMedicalExpenseDeductionMap = new HashMap<String, String>() {
            put("医療費控除_所得税", String.format("%,d", spMedicalExpenseDeduction));
            put("医療費控除_住民税", String.format("%,d", spMedicalExpenseDeduction));

    return spMedicalExpenseDeductionMap;

Responsive image

Responsive image


    Map<String, String> residentTaxMap = new HashMap<String, String>() {
            put("所得控除_住民税", String.format("%,d", spResidentTaxDeduction));
            put("課税所得_住民税", String.format("%,d", spTaxableIncomeForResidentTax));
            put("住民税", String.format("%,d", spResidentTax));
            put("住民税_都民税", String.format("%,d", spTokyoResidentTax));
            put("都民税率", (spTokyoResidentTaxRate * 100) + "%");
            put("均等割額_都民税", String.format("%,d", spFbcOtokyoResidentTax));
            put("調整控除額_都民税", String.format("%,d", spAAtokyoResidentTax));
            put("住民税_区民税", String.format("%,d", spSpecialWardResidentTax));
            put("区民税率", (spSpecialWardResidentTaxRate * 100) + "%");
            put("均等割額_区民税", String.format("%,d", spFbcOspecialWardResidentTax));
            put("調整控除額_区民税", String.format("%,d", spAAspecialWardResidentTax));
            put("住民税の月割", String.format("%,d", spMonthlyResidentTax));

            put("所得控除_住民税(青色)", String.format("%,d", spBrResidentTaxDeduction));
            put("課税所得_住民税(青色)", String.format("%,d", spBrTaxableIncomeForResidentTax));
            put("住民税(青色)", String.format("%,d", spBrResidentTax));
            put("住民税_都民税(青色)", String.format("%,d", spBrTokyoResidentTax));
            put("住民税_区民税(青色)", String.format("%,d", spBrSpecialWardResidentTax));
            put("住民税の月割(青色)", String.format("%,d", spBrMonthlyResidentTax));

    return residentTaxMap;


Responsive image


I will play the video slowly again this time. If you don't have time, it might be just right to watch at 6 times speed.


Please refer to the website of the National Tax Agency for the detailed calculation method of the deduction amount.


Since the amount of deduction has changed since around 2020, I recommend you to check the website of the National Tax Agency one by one.


Continue to Part 17.


That's all. Thank you for your hard work.