{"id":19040,"date":"2021-09-30T11:00:36","date_gmt":"2021-09-30T05:30:36","guid":{"rendered":"https:\/\/python-programs.com\/?p=19040"},"modified":"2021-11-22T18:35:31","modified_gmt":"2021-11-22T13:05:31","slug":"python-program-to-enter-basic-salary-and-calculate-gross-salary-of-an-employee","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-enter-basic-salary-and-calculate-gross-salary-of-an-employee\/","title":{"rendered":"Python Program to Enter Basic Salary and Calculate Gross Salary of an Employee"},"content":{"rendered":"
In the previous article, we have discussed Python Program to Check Duck Number<\/a> It denotes the amount paid out to an individual prior to any voluntary or mandatory deductions. As a result, it is the total pay received by an employee before taxes and other deductions. Gross salary includes all sources of income and is not limited to only cash income. As a result, it includes any benefits or services received by an employee. The salary that an employee receives, on the other hand, is the net salary after deductions.<\/p>\n House rent allowance (HRA):<\/strong><\/p>\n House rent allowance, or HRA, is a salary component that covers employees’ housing expenses.<\/p>\n Formula to calculate the Gross Salary :<\/b><\/p>\n Gross salary equals the sum of the basic salary plus the HRA and any other allowances.<\/p>\n Gross salary = Basic salary + House Rent Allowance + Other Allowances<\/p>\n Gross salary =basic + da + hr + da_on_ta<\/strong><\/p>\n da=(15*basic)\/100<\/p>\n hr=(10*basic)\/100<\/p>\n da on ta=(3*basic)\/100<\/p>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Below are the ways to calculate the Gross salary from the given basic salary :<\/p>\n Approach:<\/strong><\/p>\n Below is the implementation of the above given approach:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Explore more instances related to python concepts from\u00a0Python Programming Examples<\/a>\u00a0Guide and get promoted from beginner to professional programmer level in Python Programming Language.<\/p>\n In the previous article, we have discussed Python Program to Check Duck Number Gross Salary: It denotes the amount paid out to an individual prior to any voluntary or mandatory deductions. As a result, it is the total pay received by an employee before taxes and other deductions. Gross salary includes all sources of income …<\/p>\n
\nGross Salary:<\/strong><\/p>\nGiven Basic salary = 23000<\/pre>\n
The Employee's Gross salary from the given basic salary { 23000 } = 29440.0<\/pre>\n
Given Basic salary = 18000<\/pre>\n
The Employee's Gross salary from the given basic salary { 18000 } = 23040.0<\/pre>\n
Program to Enter Basic Salary and Calculate Gross Salary of an Employee\u00a0 in Python<\/h2>\n
\n
Method #1: Using Mathematical Formula (Static Input)<\/h3>\n
\n
# Give the basic salary as static input and store it in a variable.\r\ngvn_basc_sal = 23000\r\n# Calculate the value of da from the above given mathematical formula and store\r\n# it in another variable.\r\ngvn_da = (float)(15 * gvn_basc_sal) \/ 100.0\r\n# Calculate the value of hr from the above given mathematical formula and store\r\n# it in another variable.\r\ngvn_hr = (float)(10 * gvn_basc_sal) \/ 100.0\r\n# Calculate the value of da-on-ta from the above given mathematical formula and store\r\n# it in another variable.\r\ngvn_da_on_ta = (float)(3 * gvn_basc_sal) \/ 100.0\r\n# Calculate the gross salary using the above given mathematical formula and store\r\n# it in another variable.\r\ngros_sal = gvn_basc_sal + gvn_da + gvn_hr + gvn_da_on_ta\r\n# Print the Gross salary of an employee from the given basic salary.\r\nprint(\r\n \"The Employee's Gross salary from the given basic salary {\", gvn_basc_sal, \"} =\", gros_sal)\r\n<\/pre>\n
The Employee's Gross salary from the given basic salary { 23000 } = 29440.0<\/pre>\n
Method #2: Using Mathematical Formula (User Input)<\/h3>\n
\n
# Give the basic salary as user input using the float(input()) function and\r\n# store it in a variable.\r\ngvn_basc_sal = float(input(\"Enter some random Number = \"))\r\n# Calculate the value of da from the above given mathematical formula and store\r\n# it in another variable.\r\ngvn_da = (float)(15 * gvn_basc_sal) \/ 100.0\r\n# Calculate the value of hr from the above given mathematical formula and store\r\n# it in another variable.\r\ngvn_hr = (float)(10 * gvn_basc_sal) \/ 100.0\r\n# Calculate the value of da-on-ta from the above given mathematical formula and store\r\n# it in another variable.\r\ngvn_da_on_ta = (float)(3 * gvn_basc_sal) \/ 100.0\r\n# Calculate the gross salary using the above given mathematical formula and store\r\n# it in another variable.\r\ngros_sal = gvn_basc_sal + gvn_da + gvn_hr + gvn_da_on_ta\r\n# Print the Gross salary of an employee from the given basic salary.\r\nprint(\r\n \"The Employee's Gross salary from the given basic salary {\", gvn_basc_sal, \"} =\", gros_sal)\r\n<\/pre>\n
Enter some random Number = 50000\r\nThe Employee's Gross salary from the given basic salary { 50000.0 } = 64000.0<\/pre>\n
\n