Advertisement
nosthemerc

wagecalc_v2

Nov 17th, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 KB | None | 0 0
  1. #Variables used in time based calculation
  2. WEEKS_IN_YEAR = 56
  3. MONTHS_IN_YEAR = 12
  4. WEEKS_IN_MONTH = 4.5
  5.  
  6. def GetWage():
  7.     print "What's your hourly rate?"
  8.     wage_per_hour = int(raw_input(">> $"))
  9.     print "How many hours do you work per week?"
  10.     hours_per_week = int(raw_input(">> "))
  11. def GetExpences():
  12.     print "What is your monthly rent?"
  13.     rent_per_month = int(raw_input(">> $"))
  14.     print "What do your monthly bills typically amount to?"
  15.     bills_per_month = int(raw_input(">> $"))
  16.     monthly_expences = rent_per_month + bills_per_month
  17.     yearly_expences = monthly_expences * MONTHS_IN_YEAR
  18.     return monthly_expences, yearly_expences
  19.  
  20. def CalculateWages():
  21.     weekly_paycheck = wage_per_hour * hours_per_week
  22.     monthly_wage = weekly_paycheck * WEEKS_IN_MONTH
  23.     yearly_income = weekly_paycheck * WEEKS_IN_YEAR
  24.     return weekly_paycheck, monthly_wage, yearly_income
  25.  
  26. def SubtractExpences():
  27.     monthly_net_total = monthly_wage - monthly_expences
  28.     yearly_net_total = yearly_income - yearly_expences
  29.     return monthly_net_total, yearly_net_total
  30.  
  31.  
  32. def Main():
  33.     GetWage()
  34.     GetExpences()
  35.     CalculateWages()
  36.     SubtractExpences()
  37.     print("""
  38.         You make
  39.         $%s per month and
  40.         $%s per year.
  41.  
  42.         After bills, your net income is
  43.         $%s per month and
  44.         $%s per year
  45.         so plan accordingly.
  46.         """) % (monthly_wage, yearly_income,
  47.         monthly_net_total, yearly_net_total)
  48.     raw_input("RETURN to close")
  49.  
  50. Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement