77377 - emp fuctions/employee.py
import re
counter=2
emp_dict = {
1: "Mark, 123M, (111)222-3333, [email protected], $60000",
2: "Jones, J122, (222)333-4444,
[email protected], $5000"
}
def AddEmp(i):
print("-----Employee ",counter,"-----")
employeeName = input("Enter name: ")
employeeSSN = input("Enter SSN: ")
employeeNumber = int(input("Enter phone number: "))
phoneNumber = re.sub(r'(\d{3})(\d{3})(\d{4})', r'(\1)\2-\3', str(employeeNumber))
employeeEmail = input("Enter email: ")
employeeSalary = float(input("Enter salary: "))
print('---------------------------------------------')
info = employeeName+', '+employeeSSN+', '+str(phoneNumber)+', '+employeeEmail+', $'+str(employeeSalary)
emp_dict[counter] = info
def ViewEmp():
userInput = int(input("Please enter index value to view employee's information: "))
print(emp_dict[userInput])
while(True):
print(f'There are {counter} employees in the system')
print('1. Add information about employee')
print('2. View information about employee')
print('0 to exit')
choice = int(input('Select one of the options: a'))
if (choice == 0):
break
elif (choice == 1):
counter = counter+1
AddEmp(counter)
elif (choice == 2):
ViewEmp()
else:
print('Invalid choice')
77377 - emp fuctions/report.docx
CPT200: Fundamentals of Programming Languages
Dr. Amjad Alkilani
March 4, 2021
Screenshot of running program
Variables Used in Program
employeeName = This variable is used to...