-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCIS261_Course_Project.py
More file actions
90 lines (75 loc) · 3.26 KB
/
CIS261_Course_Project.py
File metadata and controls
90 lines (75 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# AlexCrider - CIS261 - Course Project Phase 1: Create and Call Functions with Parameters
#
#
### Create function GetEmpName that will input a value into variable empname and return the value
def GetEmpName():
empname = input("Enter employee name: ")
return empname
### This function shows how to enter a value that is numeric and return the value.
def GetHoursWorked():
hours = float(input("Enter amount of hours worked: "))
return hours
### Create a function GetHourlyRate that will input a numeric value into variable hourlyrate and return the value
def GetHourlyRate():
hourlyrate = int(input("Enter hourly rate: "))
return hourlyrate
### Create a function GetTaxRate that will input a numeric value into variable taxrate and return the value
def GetTaxRate():
taxrate = int(input("Enter tax rate: "))
return taxrate
def CalcTaxAndNetPay(hours, hourlyrate, taxrate):
## complete the code to calculate grosspay, incometax, and net pay
grosspay = hourlyrate * hours
incometax = taxrate * hours
netpay = grosspay - incometax
return grosspay, incometax, netpay
def printinfo(empname, hours, hourlyrate, grosspay, taxrate, incometax, netpay):
print("Name: ", empname)
print("Hours Worked: ", f"{hours:,.2f}")
## complete the code to display hourlyrate, grosspay, taxrate, incometax, and netpay with appropriate labels and formatting
print("Hourly Rate: " , hourlyrate)
print("Gross Pay: ", grosspay)
print("Tax Rate: ", taxrate)
print("Income Tax: ", incometax)
print("Net Pay: ", netpay)
print()
def PrintTotals(TotEmployees, TotHours, TotGrossPay, TotTax, TotNetPay):
print()
print(f"Total Number Of Employees: {TotEmployees}")
print(f"Total Hours Worked: {TotHours:,.2f}")
## complete the code to display TotGrossPay, TotTax, and TotNetPay with appropriate lables and formatting
print(f"Total Gross Pay: {TotGrossPay}")
print(f"Total Tax: {TotTax}")
print(f"Total Net Pay: {TotNetPay}")
if __name__ == "__main__":
TotEmployees = 0
TotHours = 0.00
TotGrossPay = 0.00
TotTax = 0.00
TotNetPay = 0.00
while True:
## call the function GetEmpName and assign the return value to empname
empname = GetEmpName()
if (empname.upper() == "END"):
break
## call the function GetHoursWorked and assign the return value to hours
hours = GetHoursWorked()
if hours == "END":
break
## call the function GetHourlyRate and assign the return value to hourlyrate
hourlyrate = GetHourlyRate()
if hourlyrate == "END":
break
## call the function GetTaxRate and assign the return value to taxrate
taxrate = GetTaxRate()
if taxrate == "END":
break
grosspay, incometax, netpay = CalcTaxAndNetPay(hours, hourlyrate, taxrate)
printinfo(empname, hours, hourlyrate, grosspay, taxrate, incometax, netpay)
TotEmployees += 1
TotHours += hours
TotGrossPay += grosspay
TotTax += incometax
TotNetPay += netpay
## call the function PrintTotals and pass in TotEmployees, TotHours, TotGrossPay, TotTax, and TotNetPay
PrintTotals (TotEmployees, TotHours, TotGrossPay, TotTax, TotNetPay)