structure updates

This commit is contained in:
2024-05-01 12:28:44 -06:00
parent a689e58eea
commit aeba9bdb34
461 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
#!/usr/bin/env python3
# PTO Countdown
import os
from datetime import datetime, timedelta
# Clear the terminal screen
os.system('cls' if os.name == 'nt' else 'clear')
def calculate_reach_date(current_hours, max_hours, hours_added_bi_weekly):
"""
Calculates the estimated date when the maximum Paid Time Off (PTO) hours will be reached.
Parameters:
- current_hours (float): The current total of PTO hours accumulated by the user.
- max_hours (float): The maximum PTO hours that can be accumulated.
- hours_added_bi_weekly (float): The number of PTO hours added every two weeks.
Returns:
- datetime.date: The estimated date when the maximum PTO balance is reached.
"""
hours_needed = max_hours - current_hours
bi_weekly_periods_needed = hours_needed / hours_added_bi_weekly
days_needed = bi_weekly_periods_needed * 14
reach_date = datetime.now() + timedelta(days=days_needed)
return reach_date
# Constants for the program
MAX_HOURS = 240
HOURS_ADDED_BI_WEEKLY = 6.15384615 # 160 hours per year
# HOURS_ADDED_BI_WEEKLY = 7.69230769 # 200 hours per year
# HOURS_ADDED_BI_WEEKLY = 9.61538462 # 250 hours per year
LAST_KNOWN_PTO_BALANCE = 220.08
# Introduction and instructions for the user
print("PTO Balance Calculator")
print("----------------------")
print("Determine when you will reach your maximum PTO balance based on your current accrual.")
print(f"\nLast known PTO balance: {LAST_KNOWN_PTO_BALANCE}\n")
# Handling user input
try:
current_hours_input = input("Enter your current PTO hours: ")
current_hours = float(current_hours_input.strip())
reach_date = calculate_reach_date(current_hours, MAX_HOURS, HOURS_ADDED_BI_WEEKLY)
print("\nCalculation Results")
print("-------------------")
print(f"Today's Date: {datetime.now().strftime('%A, %B %d, %Y')}")
print(f"Maximum PTO balance of {MAX_HOURS} hours will be reached on: {reach_date.strftime('%A, %B %d, %Y')}.")
except ValueError:
print("Error: Please enter a valid number for your current PTO hours.")