0% found this document useful (0 votes)
135 views

Assignment No-1 NPS

1) The document provides instructions for a programming assignment to calculate an employee's salary using Python. It includes taking the basic pay as input, and calculating HRA as 10% of basic pay, TA as 5% of basic pay, and deducting 2% of the total salary as professional tax. 2) It describes the required hardware as a computer with at least an i3 processor, 1GB RAM and 2GB hard disk space. The recommended software is a 64-bit Linux OS along with Python programming tools like Anaconda or PyCharm. 3) Sample Python code is provided to calculate salary components like basic pay, DA, HRA, PF and net pay by getting input for number of days

Uploaded by

Aditya Wadkar
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
135 views

Assignment No-1 NPS

1) The document provides instructions for a programming assignment to calculate an employee's salary using Python. It includes taking the basic pay as input, and calculating HRA as 10% of basic pay, TA as 5% of basic pay, and deducting 2% of the total salary as professional tax. 2) It describes the required hardware as a computer with at least an i3 processor, 1GB RAM and 2GB hard disk space. The recommended software is a 64-bit Linux OS along with Python programming tools like Anaconda or PyCharm. 3) Sample Python code is provided to calculate salary components like basic pay, DA, HRA, PF and net pay by getting input for number of days

Uploaded by

Aditya Wadkar
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 4

ASSIGNMENT. NO.

01

Title:

To calculate salary of an employee given his basic pay (take as input from user). Calculate
salary of employee. Let HRA be 10 % of basic pay and TA be 5% of basic pay. Let employee
pay professional tax as 2% of total salary. Calculate salary payable after deductions.

Objective:

Understand basic concepts of programming language and try to solve mathematical


calculations in programming approach with the help of formulas and equations.

Problem Statement:

To Calculate salary payable of employee

Outcomes:
1 Students will be able to demonstrate calculations of employee salary.
2 Students will be able to demonstrate different Operator & formulas.
3 Students will be able to demonstrate different Operations on Available data of employee
salary.

Hardware Requirement: Any CPU with i3 Processor or similar, 1 GB RAM or more,2 GB


Hard Disk or more

Software Requirements: 32/64 bit Linux(Ubuntu/Fedora)Operating System, latest any


Python Tool Like Anaconda,Pycharm, Python IDLE, Python Atom, Eclipse.

Theory:
Python Basics:
Python is an interpreted, high-level, general-purpose programming language. Created by
Guido van Rossum and first released in 1991, Python's design philosophy emphasizes code
readability with its notable use of significant whitespace.
What is Basic salary?
Basic salary is the base income of an individual. It is a fixed part of one's compensation
package.

A basic salary depends on the employee’s designation and also the industry in which the
employee works.
Basic salary is the amount paid to an employee before any extras are added or taken off, such
as reductions because of salary sacrifice schemes or an increase due to overtime or a bonus.
Allowances, such as internet for home-based workers or contributions to phone usage, would
also be added to the basic salary.
Gross salary:

Gross salary is the amount calculated by adding up one's basic salary and allowances, before
deduction of taxes and other deductions. It includes bonuses, over-time pay, holiday pay, and
other differentials.
Gross Salary = Basic Salary + HRA + Other Allowances

Allow
ances:
An allowance is an amount received by the employee for meeting service requirements.
Allowances are provided in addition to the basic salary and vary from company to company.
Some common types of allowances are shown below:

 HRA or House Rent Allowance: It is an amount paid out to employees by companies


for expenses related to rented accommodation.
 Leave Travel Allowance (LTA): LTA is the amount provided by the company to cover
domestic travel expenses of an employee. It does not include the expenses for food,
accommodation, etc. during the travel.
 Conveyance Allowance: This allowance is provided to employees to meet travel
expenses from residence to work.
 Dearness Allowance: DA is a living allowance paid to employees to tackle the effects
of inflation. It is applicable to government employees, public sector employees, and
pensioners only.
 Other such allowances are the special allowance, medical allowance, incentives, etc.

HRA:
HRA received is not fully exempt from tax. HRA that you can claim is the lowest of the
following:

 The total amount received as the HRA from the employer in the financial year.
 Actual rent paid in the year – 10% of the basic salary in the year.
 50% of the annual basic salary if staying in a metro city or 40% of the annual basic
salary if staying in a non-metro city.
Sample Example:
Python program to get employee wages and number of days worked from user and find
Basic Pay, DA, HRA, PF and Net Pay.
(Note HRA, DA and PF are 10%,5%and 12% of basicpay respectively.)

Sample Input 1:
300
30
Sample
Output 1:
Basic
Pay:3000
DA: 150
HRA:300
PF:360
Net Pay: 3090

Solution:
days=float(input("Enter No Days
Present:")) wages=float(input("Enter
wages per Day:")) basic=wages*days;
HRA=basic*0.1;
DA=basic*0.05;
PF=basic*0.12;
netsalary=basic+HRA+D
A-PF;
print("\nBasic:%lf \nHRA:%lf \nDA:%lf \nPF:%lf \nNet Salary:
%lf" % (basic,HRA,DA,PF,netsalary));

Calculate Gross Salary Python Program

This python program is using if else statement to compute the gross salary from basic salary
input. Here we have two different logic's to compute gross salary. so we are using if and else
statements. # function computes the gross salary from basic salary.
def
calcualte_gross_salary(basic_sal
ary): hra = 0;
da = 0;

# salary is less than 2500, hra and da is calculated using this logic, otherwise else
logic. if (basic_salary < 2500):
hra = (basic_salary *
10) / 100; da =
(basic_salary * 90) / 100;
else:

hra = 1000;
da = (basic_salary *
95) / 100; return
(basic_salary + hra + da);
if name == " main ":
# Type casting from input string into float
value. basic_salary = float(input("Enter basic
salary: ")); gross_salary =
calcualte_gross_salary(basic_salary);
print("Gross Salary is: %f" % gross_salary);

Output:

$ python

gross_salary.py

Enter basic salary:

3400

Gross Salary is:

7630.000000
$ python
gross_salary.py Enter
basic salary: 2000
Gross Salary is:
4000.000000

Conclusion:

Thus, we have successfully understood concept of salary calculation formulas and performed
salary calculation in python.

You might also like