🛠️ToolsShed

연봉-시급 변환기

시급, 일급, 주급, 월급, 연봉을 상호 변환합니다. 근무 시간 및 일수를 자유롭게 설정하세요.

자주 묻는 질문

코드 구현

def salary_breakdown(amount, period, hours_per_day=8, days_per_week=5, weeks_per_year=52):
    """Convert salary from any period to all standard periods."""
    hours_per_week = hours_per_day * days_per_week
    hours_per_year = hours_per_week * weeks_per_year
    annual = {
        "hourly": amount * hours_per_year,
        "daily": amount * days_per_week * weeks_per_year,
        "weekly": amount * weeks_per_year,
        "biweekly": amount * weeks_per_year / 2,
        "semimonthly": amount * weeks_per_year / 24 * 2,
        "monthly": amount * weeks_per_year / 12,
        "quarterly": amount * weeks_per_year / 4,
        "annual": amount,
    }
    # First convert to annual, then to each period
    if period not in annual:
        raise ValueError(f"Unknown period: {period}")
    yearly = annual[period]
    hourly = yearly / hours_per_year
    return {
        "hourly": round(hourly, 4),
        "daily": round(hourly * hours_per_day, 2),
        "weekly": round(hourly * hours_per_week, 2),
        "biweekly": round(hourly * hours_per_week * 2, 2),
        "semimonthly": round(yearly / 24, 2),
        "monthly": round(yearly / 12, 2),
        "quarterly": round(yearly / 4, 2),
        "annual": round(yearly, 2),
    }

# Example: $60,000 annual salary
result = salary_breakdown(60000, "annual")
for k, v in result.items():
    print(k, ":", v)

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.