Skip to content

Instantly share code, notes, and snippets.

@Starlight258
Last active January 15, 2024 08:02
Show Gist options
  • Save Starlight258/6ef6a1647428072848a277822ddce67d to your computer and use it in GitHub Desktop.
Save Starlight258/6ef6a1647428072848a277822ddce67d to your computer and use it in GitHub Desktop.
0114_과제8
// 김명지
// 못풀었어요
import java.util.Scanner;
public class a8 {
static final int SIX_PERCENT_AMOUNT = 12 * 1000000;
static final int FIFTEEN_PERCENT_AMOUNT = 46 * 1000000;
static final int TWENTYFOUR_PERCENT_AMOUNT = 88 * 1000000;
static final int THIRTYFIVE_PERCENT_AMOUNT = 150 * 1000000;
static final int THIRTYEIGHT_PERCENT_AMOUNT = 300 * 1000000;
static final int FOURTY_PERCENT_AMOUNT = 500 * 1000000;
static final int FOURTYTWO_PERCENT_AMOUNT = 1000 * 1000000;
public static void main(String[] args) {
// 입력받기
System.out.println("[과세금액 계산 프로그램]");
Scanner sc = new Scanner(System.in);
System.out.print("연소득을 입력해 주세요.:");
int money = sc.nextInt();
int originalMoney = money;
// 과세금액 계산 1
int tax = 0;
// while (true) {
// 6 %
if (originalMoney>= SIX_PERCENT_AMOUNT) {
money -= SIX_PERCENT_AMOUNT;
tax = (int) (SIX_PERCENT_AMOUNT * 0.06);
System.out.printf("%d * 6%% = \t %d", SIX_PERCENT_AMOUNT, tax);
} else{
tax = (int) ((money - SIX_PERCENT_AMOUNT) * 0.06);
System.out.printf("%d * 6%% = \t %d", money, tax);
// break;
}
// System.out.printf("%d * 6%% = \t %d", money, tax);
// 15 %
if (originalMoney>= FIFTEEN_PERCENT_AMOUNT) {
// money -= FIFTEEN_PERCENT_AMOUNT;
tax = (int) (FIFTEEN_PERCENT_AMOUNT * 0.15);
System.out.printf("%d * 15%% = \t %d", FIFTEEN_PERCENT_AMOUNT, tax);
} else{
tax = (int) ((money - FIFTEEN_PERCENT_AMOUNT) * 0.15);
System.out.printf("%d * 15%% = \t %d", money, tax);
// break;
}
// System.out.printf("%d * 15%% = \t %d", money, tax);
// }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment