Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use python please. show code separate and show explanatin separate for me to und

ID: 3887766 • Letter: U

Question

Use python please. show code separate and show explanatin separate for me to understand. thanks

Working with Variables, Functions, & Strings Financial application: Payroll & Access Code creation JMU Widgets is new startup company in Harrisonburg and has learned that you are taking a programming class. They are very interested in some help creating a payroll and Access Code program and they have come to you for help. You will create a Python program (named: LastnameFirstinitial PA2) to calculate the total net paycheck and Access Code using the following information Data to be input: Employee Name (first & last) Number of hours worked Hourly pay rate Married or Single (to determine Federal tax rate State tax rate "Married tax rate 10%, single tax rate 15% (use decision statement to testfirst letteronly, make sure to change the capitalization to what you are testing). You may also want to use the Round function. Determine Access Code: Create and combine the following 3 strings to determine Access Code. You will use string functions, methods, and operators for this String 1. take the portion of the name that starts at the position numbered by the length of the string, integer divided by 3, and includes up to character 7 (see 2 examples) String 2. take the last 3 letters in capitals String 3. take the min and max

Explanation / Answer

Question 1

Python 2.7 code:

#take all the inputs from user
name = raw_input("Enter the employee name(First and last) ")
n_hours_worked = float(raw_input("Number of hours worked! "))
pay_rate = float(raw_input("hourly pay rate! "))
M_S = raw_input("Enter M if you are married otherwise enter S ")
tax_rate = float(raw_input("Enter tax rate! "))

print "Employee name: ", name
Total = n_hours_worked*pay_rate
print "Total Payment: ", Total #display payment without tax
if(M_S.lower() == "m"):
tax = Total*10.0/100
print "Tax amount: ", tax #display tax amount
print "Actual in-hand Income: ", Total - tax #display payment after deducting tax
else:
tax = Total*10.0/100
print "Tax amount: ", tax
print "Actual in-hand Income: ", Total - tax

Sample Output:

Enter the employee name(First and last)
Joe root
Number of hours worked!
100
hourly pay rate!
100
Enter M if you are married otherwise enter S
M
Enter tax rate!
10
Employee name: Joe root
Total Payment: 10000.0
Tax amount: 1000.0
Actual in-hand Income: 9000.0

Question 2

Python 2.7 code:

name = raw_input("Enter the employee name(First and last) ") #take input employee name
if(len(name) > 3):    # check if employee name contains more than 3 characters or not
startindex = len(name)/3;
string1 = name[startindex:startindex+7];#find string1
string2 = name[len(name)-3:len(name)].upper()#find string2
string3 = name[0] + name[len(name)-1]#find string3
print "string1: ", string1 , " ","string2: ", string2 , " ","string3: ", string3 , " "
print "Access key: ", string1 + string2 + string3 #print Access key
else:
print "Name must contain more than 3 characters!"

Sample Output:

Enter the employee name(First and last)
jonny christopher
string1:   christ
string2: HER
string3: jr

Access key:   christHERjr

Note: For String 3, According to the statement "take the min and max" I am assuming that question expects first and last character of the name! If it has any other meaning, then comment below the exact meaning! I will change the code accordingly!