Question

In: Computer Science

Write a complete and syntactically correct Python program to solve the following problem: You are the...

Write a complete and syntactically correct Python program to solve the following problem: You are the payroll manager for SoftwarePirates Inc. You have been charged with writing a package that calculates the monthly paycheck for the salespeople. Salespeople at SoftwarePirates get paid a base salary of $2000 per month. Beyond the base salary, each salesperson earns commission on the following scale: Sales Commission Rate Bonus <$10000 0% 0 $10000 – $100,000 2% 0 $100,001 - $500,000 15% $1000 $500,001 - $1,000,000 28% $5000 >$1,000,000 35% $100,000 The following additional conditions apply: 1. If a salesperson has taken more than 3 vacation days in a month, their pay gets reduced by $200 2. A salesperson earns a bonus only if they have been with the company for 3 months or more 3. For salespeople who have been with the company for 5 years or more and who have made sales greater than $100,000 an additional bonus of $1000 is added. All input to the program will be interactive from the keyboard. The output of the program will include: a. The name of the salesperson b. Their longevity with the company c. Their base salary d. The commission earned (in Dollars) e. The bonus earned f. Additional bonus earned (if any) g. Deductions (if any) h. A total gross paycheck i. Your output should look like a paystub (NOT in paragraph format) j. All currency should be formatted with a $ sign and 2 decimal places

Solutions

Expert Solution

'''

Python version : 2.7

Python program to calculate the monthly paycheck for the salespeople.

'''

print('Payroll manager for SoftwarePirates Inc\n')

# input of name

name = raw_input('Enter your name : ')

# input of number of vacation days taken

vacation_days = int(raw_input('Number of vacation days taken : '))

# input of number of months with the company

longevity = int(raw_input('Number of months with the company : '))

# input of sales amount for the month

sales = float(raw_input('Enter sales amount : '))

# set the base salary

base_salary = 2000;

salary = base_salary

# calculate the number of years and months with the company

years = int(longevity/12)

months = (longevity - (12*years))

# set variables for deduction, additional_bonus and commission

deduction = 0

additional_bonus = 0

commission = 0

# calculate the commission_percent and bonus based on the sales

if sales < 10000 :

               commission_percent = 0

               bonus = 0

elif sales <= 100000         :

               commission_percent = 0.02

               bonus = 0

elif sales <=500000          :

               commission_percent = 0.15

               bonus = 1000

elif sales <= 1000000:

               commission_percent = 0.28

               bonus = 5000

else:

               commission_percent = 0.35

               bonus = 100000

# calculate total commission       

commission =(sales*commission_percent)            

# determine deduction

if vacation_days > 3 :      

               deduction = 200

# determine if bonus is applicable or not

if longevity < 3:

               bonus = 0

# determine additional_bonus     

if( (longevity >= 60) and (sales > 100000)):

               additional_bonus = 1000

# calculate gross salary for the month     

salary = base_salary + commission - deduction + additional_bonus              

              

# output the data            

print('\nName of the salesperson : '+name)

if(years > 0 and months > 0):

               print('Longevity with the company : %d years %d months'%(years,months))

elif(years > 0):

               print('Longevity with the company : %d years '%(years))

else:

               print('Longevity with the company : %d months '%(months))

print('Base Salary : $%.2f' %(base_salary))             

print('The commission earned: $%.2f' %(commission))

if(bonus > 0):

               print('The bonus earned : $%.2f' %(bonus))

if(additional_bonus > 0):

               print('Additional bonus earned $%.2f' %(additional_bonus))

              

if(deduction > 0):

               print('Deductions : $%.2f' %(deduction))

print('Total gross paycheck :$%.2f '%(salary))          

#end of program             

Code Screenshot:

Output:


Related Solutions

Write a complete and syntactically correct Python program to solve the following problem: Write a program...
Write a complete and syntactically correct Python program to solve the following problem: Write a program for your professor that allows him to keep a record of the students’ average grade in his class. The program must be written in accordance with the following specs: 1. The input must be interactive from the keyboard. You will take input for 12 students. 2. You will input the students’ name and an average grade. The student cannot enter an average below zero...
Complete the following in syntactically correct Python code. Write a program, using a for loop, that...
Complete the following in syntactically correct Python code. Write a program, using a for loop, that calculates the amount of money a person would earn over a period of time if his or her salary is 1 penny for the first day, 2 pennies for the second day, 4 pennies for the third day, and continues to double each day. 1.      The program should ask the user for the number of days the employee worked. 2.      Display a table showing the salary...
Write a complete Java Program to solve the following problem. February 18 is a special date...
Write a complete Java Program to solve the following problem. February 18 is a special date as this is the date that can be divisible by both 9 and 18 Write a program that asks the user for a numerical month and numerical day of the month and then determines whether that date occurs before, after, or on February 18. If the date occurs before February 18, output the word Before. If the date occurs after February 18, output the...
IN PYTHON Write a program to do the following: Solve the a set of equations as...
IN PYTHON Write a program to do the following: Solve the a set of equations as mentioned in "Zybook 5.20 LAB: Brute force equation solver". Instead of the arithmetic operators use your own function defined in a module named calc. You must provide two files (calc.py, brute_force_solver.py) :- 1) calc.py:- Add function named 'add' instead of using operator '+' [10pts] Add function named 'difference' instead of using operator '-' [10pts] Add function named 'product' instead of using operator '*' [10pts]...
Write a complete Java program to solve the following problem. Read two positive integers from the...
Write a complete Java program to solve the following problem. Read two positive integers from the user and print all the multiple of five in between them. You can assume the second number is bigger than the first. For example if the first number is 1 and the second number is 10, then your program should output 5 10 Java must be grade 11 work easy to understand and not complicated code
Write a Python program to solve the 8-puzzle problem (and its natural generalizations) using the A*...
Write a Python program to solve the 8-puzzle problem (and its natural generalizations) using the A* search algorithm. The problem. The 8-puzzle problem is a puzzle invented and popularized by Noyes Palmer Chapman in the 1870s. It is played on a 3-by-3 grid with 8 square blocks labeled 1 through 8 and a blank square. Your goal is to rearrange the blocks so that they are in order, using as few moves as possible. You are permitted to slide blocks...
A: Write a divide-and-conquer program to solve the following problem:
in Java A: Write a divide-and-conquer program to solve the following problem:     1. Let A[1..n] and B[1..n] be two arrays of distinct integers, each sorted in an increasing order.      2. Find the nth smallest of the 2n combined elements. Your program must run in O(log n) time. For example: n = 4If A[1..n] = {2, 5, 8, 9} and B[1..n] = {1, 4, 6, 7}The nth (i.e. 4th) smallest integer is 5.If A[1..n] = {2, 5, 8, 13}...
Complete the following in syntactically correct Python code. 1. The program should display a message indicating...
Complete the following in syntactically correct Python code. 1. The program should display a message indicating whether the person is an infant, a child, a teenager, or an adult. Following are the guidelines: a. If the person is older than 1 year old or less, he or she is an infant. b. If the person is older than 1 year, but younger than 13, he or she is a child c. If the person is at least 13 years old,...
please solve the following in python: write a program for the decryption of 2-rail fence cipher....
please solve the following in python: write a program for the decryption of 2-rail fence cipher. For example, the input "Cmhmtmrooeoeoorw" should return "Comehometomorrow", and input "topaesw lyr" should return "two players".
please solve the following in python: write a program for the decryption of 2-rail fence cipher....
please solve the following in python: write a program for the decryption of 2-rail fence cipher. For example, the input "Cmhmtmrooeoeoorw" should return "Comehometomorrow", and input "topaesw lyr" should return "two players".
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT