Last active
March 11, 2023 16:52
-
-
Save coha96/69001e07de9acb8c200398a4641fd768 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
하수빈 | |
과제8. 연소득 과세금액 계산 프로그램 | |
*/ | |
import java.util.Scanner; | |
public class Income { | |
public static int resulttax(int money) { //세율에 의한 세금 함수 | |
// {}이하 - {}초과 계산 | |
int[] taxbase = {12000000, 34000000, 42000000, 62000000, 150000000, 200000000, 500000000, 1000000000}; | |
int [] tariff = {6, 15, 24, 35, 38, 40, 42, 45}; // 세율 | |
int totaltax = 0; // 세금 총합 | |
int change = money; // 남은 돈 | |
int i = 0; | |
while(change-taxbase[i]>0) { | |
totaltax = totaltax + (int)(taxbase[i] * tariff[i])/100; | |
change = change - taxbase[i]; | |
System.out.printf("\t%d * %d%% = \t%d\n", taxbase[i], tariff[i], (taxbase[i]*tariff[i])/100); | |
i++; | |
} | |
totaltax = totaltax + (int)(change * tariff[i])/100; | |
System.out.printf("\t%d * %d%% = \t%d\n", change, tariff[i], (change*tariff[i])/100); | |
return totaltax; | |
} | |
public static int resulttax2(int money) { //누진공제에 의한 세금 함수 | |
if(money>12000000 && money<=46000000) | |
{ | |
money *= 0.15; | |
money -= 1080000; | |
} else if (money>46000000 && money<=88000000) { | |
money *= 0.24; | |
money -= 5220000; | |
} else if (money>88000000 && money<=150000000) { | |
money *= 0.35; | |
money -= 14900000; | |
} else if (money>150000000 && money<=300000000) { | |
money *= 0.38; | |
money -= 19400000; | |
} else if (money>300000000 && money<=500000000) { | |
money *= 0.40; | |
money -= 25400000; | |
} else if (money>500000000 && money<=1000000000) { | |
money *= 0.42; | |
money -= 35400000; | |
} else if (money>1000000000) { | |
money *= 0.45; | |
money -= 65400000; | |
} | |
return money; | |
} | |
public static void main(String[] args) | |
{ | |
int money = 0; | |
int numoney = 0; | |
int etc = 0; | |
System.out.println("[과세금액 계산 프로그램]"); | |
System.out.print("연소득을 입력해 주세요.:"); | |
Scanner sc = new Scanner(System.in); | |
money = sc.nextInt(); | |
etc = money; | |
if(etc <= 12000000) | |
{ | |
money = (etc * 6) / 100; | |
System.out.printf("%d * 6%%\n", etc); | |
} | |
else { | |
money = resulttax(etc); // 세율에 의한 세금 함수 resulttax | |
numoney = resulttax2(etc); // 누진공세 계산에 의한 세금 함수 resulttax2 | |
} | |
System.out.println(); | |
System.out.printf("[세율에 의한 세금]:%19d\n" , money); | |
System.out.printf("[누진공제 계산에 의한 세금]:%12d" , Math.round(numoney)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment