0% found this document useful (0 votes)
9 views3 pages

Python Employee Bonus and Billing Program

The document outlines two Python programming tasks. Task 1 involves creating a program to calculate employee bonuses based on salary and years of experience, and print a payslip. Task 2 requires a program to calculate the net price of products after applying discounts based on the product type and quantity, and print a formatted bill.

Uploaded by

Random Dude
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Python Employee Bonus and Billing Program

The document outlines two Python programming tasks. Task 1 involves creating a program to calculate employee bonuses based on salary and years of experience, and print a payslip. Task 2 requires a program to calculate the net price of products after applying discounts based on the product type and quantity, and print a formatted bill.

Uploaded by

Random Dude
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Selection – Python Practicals Extra

Task1:

Write a python program to read employee number , name , job, years of experience and salary then
calculate the bonus using following conditions:

Salary Bonus

>=25000 50% of Salary

>=20000 25% of Salary

>=15000 12 % of salary

>=10000 10% of salary

<10000 5%of salary

Note: The above bonus is applicable , if the employee working experience is 5 years or more.
Otherwise bonus is 500.

Print Employee payslip in the proper format (including all details – line by line)

name=input("enter your name: ")

number=int(input("enter your number: "))

job=input("enter your job: ")

years_of_experience=int(input("enter number of years: "))

salary=float(input("enter your salary: "))

if years_of_experience>=5:

if salary>=25000:

bonus=(50/100)*salary

elif salary>=20000:

bonus=(25/100)*salary

elif salary>=15000:

bonus=(12/100)*salary
elif salary>=10000:

bonus=(10/100)*salary

else:

bonus=(5/100)*salary

else:

bonus=500

print("bonus=",bonus)

Task2:

Write a python program to read product code, name, product type ,qty, price,

The input of product type should be either (garments/ food/ house hold)

then calculate the actual price by multiplying qty with price.

Then calculate net price by subtracting actual price with discount

The condition for discount amount:

Actual Amount Discount

>=1000 150

>=500 120

>=300 100

>=100 50

<100 10

The above discounts are not applicable for food items

Print the bill in the following format:

**********************************************
Bill Amount

**********************************************

Product Code: <pcode>

Product name: <pname>

Product type :< ptype>

Price: <price>

Qty : <qty>

Actual price : <actualprice>

Discount:<discount>

Net Price:<netprice>

**********************************************

Thank u for visiting

**********************************************

Common questions

Powered by AI

The program efficiently calculates employee bonuses based on well-defined salary brackets and years of experience, providing a customizable and straightforward structure. Similarly, it applies product discounts based on actual price ranges, making it effective for merchandising cost adjustments. However, the program has limitations, such as not accounting for edge cases where salaries exactly match the boundary conditions and not applying dynamic discount policies that could consider seasonal or demand-based changes .

If an employee has exactly five years of experience, they qualify for a variable bonus based on their salary. Salaries of at least 25,000 receive a 50% bonus, those of at least 20,000 receive 25%, 12% for at least 15,000, 10% for at least 10,000, and 5% for less than 10,000. This variability significantly impacts the payslip, providing an incentive for higher salaries linked to commensurate bonuses .

Employee payslips and bills are printed in a structured line-by-line format that includes all relevant details such as name, job, years of experience, salary, and bonus for payslips; and product code, name, type, price, quantity, actual price, discount, and net price for bills. This detailed presentation ensures important information is clearly communicated, allows easy verification of details, and enhances readability, which is beneficial for both employees and customers for record-keeping and review purposes .

Introducing new product types or revising salary bands requires careful modification of conditional logic to accurately apply discounts or bonuses. For new product types, an extended check must be implemented to handle different discount scenarios. Adjusting salary bands necessitates redefining the bonus thresholds to ensure fairness and clarity. Properly structuring the program with scalable functions and employing dictionaries for dynamic controls can resolve these changes effectively without extensive rework of existing logic .

To qualify for a 50% salary bonus, an employee must have a salary of at least 25,000 and a minimum of 5 years of experience. If these conditions are met, the bonus is half of the employee's salary .

The program calculates discounts based on the actual price, which is the product of quantity and price. Discounts are applied as follows: 150 for >= 1000, 120 for >= 500, 100 for >= 300, 50 for >= 100, and 10 for < 100. Notably, these discounts are not applicable for food items, which means food products don't receive any discounts .

The program employs a conditional structure to check the product type when calculating discounts, using specific ranges of the actual price for garments and house hold items. A key condition excludes food items from any discount by checking the product type, ensuring that no discount logic applies for such items. This division is implemented through `if` statements which filter products based on their type before applying any discount calculations .

The program prompts the user to enter the product type, which must explicitly be either 'garments', 'food', or 'house hold'. This categorical restriction is significant because it ensures appropriate discount rules are applied, particularly excluding discounts for food items. It prevents logical errors in discount calculation by limiting the product type input to pre-defined categories .

The program employs fixed discount values, perhaps to simplify calculations and maintain uniform discount amounts across similar price brackets, regardless of the product price within those brackets. This method ensures stability in discount allocation but might lack flexibility and could disadvantage customers with more expensive items within a discounted range, as the discount does not scale with price .

The program determines an employee's bonus based on their salary and years of experience. For employees with 5 or more years of experience, the bonus is a percentage of the salary: 50% if salary >= 25,000, 25% if salary >= 20,000, 12% if salary >= 15,000, 10% if salary >= 10,000, and 5% otherwise. Employees with less than 5 years of experience receive a fixed bonus of 500 .

You might also like