Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Week 1 Interactive Assignment Python Variables CPT200: Fundamentals of Programming Languages Dr. Amjad Alkilani March 4, 2021 Screenshot of running program Variables Used In Program employeeName =...

1 answer below »
Week 1 Interactive Assignment Python Variables
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 store in employee name
employeeSSN = This variable is used to store in employee SSN
employeeNumber = This variable is used to store in employee numbe
employeeEmail = This variable is used to store in employee email
employeeSalary = This variable is used to store in employee salary
This program is used to prompt user employee information and display the information
Code:
employeeName = input("Enter name: ")
employeeSSN = input("Enter SSN: ")
employeeNumber = int(input("Enter phone number: "))
employeeEmail = input("Enter email: ")
employeeSalary = float(input("Enter salary: "))
print("\n--------------------------------")
print("Name: "+employeeName)
print("SSN: "+employeeSSN)
print("Phone Number: "+str(employeeNumber))
print("Email: "+employeeEmail)
print("Salary: $"+str(employeeSalary))
print("--------------------------------")

Use a basic list structure to enhance Functionality 1 that you developed in Week 1. You should allow users to enter information for five employees at the same time, where the first employee information entry is saved in index [0] and the second entry is saved in index [1], and so on. You want to make sure to enforce the user to enter the following employee information: employeeName, employeeSSN, employeePhone, employeeEmail, employeeSalary. After the user finishes entering the last employee information, they should get a message to allow them to print specific employee information from the saved list. The user can enter values between 1 and 5, where 1 will return the employee information saved in the list index [0], 2 will return the employee information saved in the list index [1] and so on. The printed result should be in the following format:
Mike Smith, 123123, XXXXXXXXXX, XXXXXXXXXX,$6000
Once you have completed Functionality 2, you must provide the following in a Word document and submit it through the Waypoint grading system:
· One screen shot of the completed functionality.
· An explanation of how you used variables and functions to employ the list data structure to allow users to enter information for five employees at the same time.
· A
ief description of the purpose of this functionality.
· The script for this functionality.
Answered 6 days After Mar 03, 2021

Solution

Neha answered on Mar 03 2021
145 Votes
76885 - dict in python/employee.py
import re
emp_dict={}
i=0
while(True):
if(i==5):

eak
print("-----Employee ",i+1,"-----")
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('---------------------------------------------')
i = i+1
info = employeeName+', '+employeeSSN+', '+str(phoneNumber)+', '+employeeEmail+', $'+str(employeeSalary)
emp_dict[i] = info
userInput = int(input("Please enter index value to view employee's information"))
print(emp_dict[userInput])
76885 - dict in python
eport.docx
CPT200: Fundamentals of Programming Languages
Dr. Amjad Alkilani
March...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here