In [ ]:
from time import asctime
from IPython.display import clear_output
####################################################################################
def calulatePay():
    
#the is where you put your information :3

    firstName = input("first name:") #fist name here
    print ("----------------------------")
    lastName = input("last name:") #last name here
    print ("----------------------------")
    payRate = float(input("how much do you get payed an hour:")) #how much you get paid
    print ("----------------------------")
    hours = float(input("how many hours have you worked:")) #how much hours you worked
    print ("----------------------------")

#####################################################################################

#this is the value of our variables

    fedTaxRate = .101

    stateTaxRate = .0447

    soacalSecurity = .153

    incurence = 119.00
#####################################################################################

#more magic
#and more variables TwT
    if hours > 40.00:
        basePay = payRate * 40
        overHours = hours - 40
        overTime = (payRate * 1.5) * overHours
        grossPay = basePay + overTime
        
        
    else:
        grossPay = payRate * hours
        overHours = 0.0


    
###################################################################################


    fedTaxPaid = fedTaxRate * grossPay

    stateTaxPaid = stateTaxRate * grossPay

    soacalSecurityPaid = soacalSecurity * grossPay

    totaleDeductions = fedTaxPaid + stateTaxPaid + soacalSecurityPaid + incurence

    netPay = grossPay - totaleDeductions

####################################################################################
    invoicePage = open("{}-{}-invoice.txt".format(lastName, firstName), "w+")
    
    invoicePage.write("\n")
    invoicePage.write("from Payroll form")
    invoicePage.write("\n")
    invoicePage.write("payRate: ${:.2f}".format(payRate))
    invoicePage.write("\n")
    invoicePage.write("Total hours worked:{}".format(hours))
    invoicePage.write("\n")
    invoicePage.write("Overtime hours at time and a half: {:.2f}".format(overHours))
    invoicePage.write("\n")
    invoicePage.write("Date/time report was run {}".format(asctime()))
    invoicePage.write("\n")
    invoicePage.write("Deductions\n")
    invoicePage.write("-------------------------------------\n")
    invoicePage.write("Federal Income Tax: ${:.2}\n".format(fedTaxPaid))
    invoicePage.write("\n")
    invoicePage.write("State of CT Income Tax: ${:.2f}\n".format(stateTaxPaid))
    invoicePage.write("Socal Sercirity: ${:.2f}\n".format(soacalSecurity))
    invoicePage.write("\n")
    invoicePage.write("Incurance: ${:.2f}\n".format(incurence))
    invoicePage.write("\n")
    invoicePage.write("Total Deductions: {:.2f}\n".format(totaleDeductions))
    invoicePage.write("-------------------------------------\n\n")
    invoicePage.write("{}'s total pay received is: ${:.2f}\n".format(firstName, netPay))
    invoicePage.close()

    invoiceView = open("{}-{}-invoice.txt".format(lastName, firstName), "r")
    viewFile = invoiceView.read()
    print (viewFile)
    invoiceView.close()

    print("---------------------------------")
    input("press enter to continue")
    print("---------------------------------")
####################################################################################
def menu():
    while True:
        print("wlcome to payroll calulator")
        print("  what do you want to do")
        print("-------------------------")
        print("1. Calulate pay")
        print("2. Exit")
        print("-------------------------")

        menuChoice = input("enter 1 or 2:")
        print("-------------------------")

        if menuChoice == "1":
            calulatePay()
        elif menuChoice =="2":
            print("have a nice day! :3")
            break
        else:
            print("{} is a inavlid choice".format(menuChoice))
            input("press enter:")
            clear_output()

if __name__ == "__main__":
    menu()
wlcome to payroll calulator
  what do you want to do
-------------------------
1. Calulate pay
2. Exit
-------------------------
-------------------------
----------------------------
----------------------------
----------------------------
----------------------------

from Payroll form
payRate: $834.00
Total hours worked:238.0
Overtime hours at time and a half: 198.00
Date/time report was run Wed Mar  5 09:12:01 2025
Deductions
-------------------------------------
Federal Income Tax: $2.8e+04

State of CT Income Tax: $12563.29
Socal Sercirity: $0.15

Incurance: $119.00

Total Deductions: 84071.02
-------------------------------------

Dameon's total pay received is: $196986.98

---------------------------------
In [ ]: