Program 2: Write a Python program to accept employee name and basic salary of n number of employees and calculate total salary of each employee according to the following formula Total salary = Basic salary + Allowances The value of n should also be accepted as input. All amounts should be displayed with three decimal places The output should be displayed as a table containing the Employee name, Basic salary, Allowances and Total Salary as shown below. The program must define and use a function with basic salary as a parameter and should calculate and return the allowance.
Q: How can I write a python program that uses a custom function named as you wish and the main…
A: A required Python program is as follows, #Function to print name as many times as specified by an…
Q: Write a C++ program that calculate and display the total fee for B.Sc. program in Engineering…
A: This question from the subject c++ where we have to use function and variables each for one entry.…
Q: Problem 4 Write a program called p4.py. Fill in the rest of the program, making use of the functions…
A: Solution for the given problem: In this already a list of maximum word is given then computer…
Q: Write an ARM assembly program to convert temperatures from Celsius to Fahrenheit or from Fahrenheit…
A:
Q: Problem #1: Write a program that reads from the user the name of a student, the grades of two…
A: Simple output, Your name: Ali your midters 1 grade: 70 your midterm 2 grade: 65 your final year…
Q: b) Write a complete C- Program for Student Grade Computation. Program will use two user defined…
A: Step 1:- Program Approach:- 1.Include header file 2.Create two user-defined function whose name…
Q: Write a function that accepts two arguments, double and char, which are defined as two variables…
A: Program code: //include the required functions #include <iostream> using namespace std;…
Q: Define a function named print_inverted_triangle_pattern (number_of_rows) which takes an integer as a…
A: #first lets understand the pattern#let n=5 //number of rows#1st row has 5 1's followed by 0(0*2)…
Q: 1 // C Code 2 int FindMaxInt (int a, int b) 3 { 4 Q1: In C, each function must have a unique…
A: C++ program with same function name to find the maximum of two data type number
Q: In Python, Write a program that has a main() function and a multi value returning function named…
A: EXPLANATION: You are program logic is correct. The problem is with surface are formula. The formula…
Q: Q5: Write a C++ program to read a number that represents the number of days, then send this number…
A: Required: I need the answer quickly
Q: Python Create a function named Triangle(a,b,c) which can take in three floats as inputs (a, b, and…
A: Step-1: Start Step-2: Declare three variable a, b, c and take input from user Step-3: Call function…
Q: Problem C. 75462. Modular addition Input file: Output file: Time limit: standard input standard…
A: // C program for implementation of Bubble sort #include <stdio.h> //return a+b%c int…
Q: Write a python program that contains main and another custom function that generates a specified…
A: Q: Write a python program that contains main and another custom function that generates a specified…
Q: In Python, write a program that contains main and another custom function that generates a specified…
A: Given: In Python, write a program that contains main and another custom function that generates a…
Q: Create a sum to(n) function in Python that returns the sum of all integer values up to and including…
A: The required code is as follows:-
Q: Write a properly formatted Python function called power2 () that calculates and returns a list of…
A: Python code for above : # function for above def power2(n): res = [] i = 1 while(i…
Q: In Python Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon…
A: def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):…
Q: Implement a C function, named triangle, that outputs Pascal's triangle. An example is provided…
A: #include < stdio.h > long factorial(int); int main() { int i, n, c;…
Q: Write a C++ program to calculate net pay of an employee. Input basic pay from user, and pass it to a…
A: Using C++ program, net pay has to be calculated based on the basic pay input from the user . The…
Q: Program 2: Write a Python program to accept employee name and basic salary of n number of employees…
A: def calculate_allowance(basic_salary): """returns allowance value for given basci_salary"""…
Q: Define a function named swap_values that takes four integers as parameters and swaps the first with…
A: The problem is based on the basics of functions in python programming language.
Q: 1. Write a Python code which has a function called (min). The function will find the minimum value…
A: Note: since your question contain multiple question but we can answer only first 3 question at a…
Q: Write a computer program using C++ to compute the expression (n*(2^m!)), Where n, m are positive…
A: #include<iostream> #include<math.h> using namespace std; int fact(int num)…
Q: Given the following code and program output: int main() { int x=11, y=6; cout << x << "" <<y < "\n";…
A: C++ program to solve the given problem is below.
Q: Study the definition of function "Secret" and answer the question below. double Secret (double x,…
A:
Q: Write a python program using functions to do the following: • Input Employee's ID, NAME, SALARY,…
A: Required:
Q: 3. Consider a function that will test whether a person is qualified to finance a luxury car. They…
A: Function table Name Purpose Parameters Result finance() Check whether given income…
Q: Write a program that has a main() function and a multi value returning function named rspyramid().…
A: Following points are required to write the python program for a square pyramid’s surface area and…
Q: Assume on a planet called “Chocolatey”, 1 month = 20 days and 1 year = 240 days = 12 months. Write…
A: - We have to write the code in python to get the difference in days for the given conditions.
Q: Define a Python function named calculate_tax() which accepts one parameter, income, and returns the…
A: Code : (Python 3) def main(): # gathering user income details print('Enter your income: ') income…
Q: Use C++ Write a program with total change amount as an integer input that outputs the change using…
A: A required program is as follows, #include <iostream> #include <vector> using namespace…
Q: Define a function named swap_values that takes four integers as parameters and swaps the first with…
A:
Q: Write a program that asks for 2 integer values (n and m) from the user and displays the sum of the…
A: The sum of numbers from n to m program are as follows:
Q: Python program that takes two values as user input, x and y; then applies the following equations…
A: def functionForValues(x,y): return x*10 - x*3 , y*y*y* ((2 - y) * y + y) x = float(input("Enter…
Q: Write a python program that accepts name of an employee and employee's yearly sales of last five…
A: Required:
Q: Create a Python function “stats” that asks the user to enter the following inputs: · Number…
A: The function along with the screenshot of the output is given below
Q: (python) 12. Create a function based on the following information: You prefer a good old…
A: Solution: Given, - the output format should be 'hh:mm a.m.' (for hours before midday) or 'hh:mm…
Q: 1. Write a python program to calculate the net annual income using the concept of Python functions.…
A: read net annual income read retirement deduction rate read federal tax deduction rate read state tax…
Q: Write a python program that accepts name of an employee and employee's yearly sales of last five…
A: Algorithm : main function Step 1 : asking for the number of employees n. Step 2 : declaring all the…
Q: Write a computer program using C++ to compute the expression (n*(2^m!)), Where n, m are positive…
A: Functions in C++ are a block of statements which perform a specific task. Function has three parts:…
Q: please code in python 1). Multiplication using Addition Write a function: mul(a,b) that will…
A: 1) Below is a program that defines functions for mul(a,b) that will compute and return the…
Q: Write a program with user defined function to plot and show 3 points and a line passing through…
A: Algorithm: Start the program. import the toolkit mplot3d. create a 3d projection and define axes.…
Q: Write a function print_rainfalls(rainfalls) that extends the earlier print_daily_totals(rainfalls)…
A: GIVEN:
Q: Create a functional program that can calculate the displacement and velocity of a free-falling body…
A: Program: #include <iostream> #include <cmath> using namespace std; void…
Q: c++ prob. please paste indented code Given the following code and program output: int main() {…
A: #include <iostream> using namespace std; voiddecrement (int &val, int offset){ val = val…
Q: Write a program that reads in two numbers and stores them into two variables a and b respectively.…
A: Program approach: Create input function to input values. Create processing function to swap the…
Q: Python Suppose scDict maps names to test scores. Print each name/score on a separate line Write a…
A: note: We’ll answer the first question since the exact one wasn’t specified. Please submit a new…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images
- (Numerical) Heron’s formula for the area, A, of a triangle with sides of length a, b, and c is A=s(sa)(sb)(sc) where s=(a+b+c)2 Write, test, and execute a function that accepts the values of a, b, and c as parameters from a calling function, and then calculates the values of sand[s(sa)(sb)(sc)]. If this quantity is positive, the function calculates A. If the quantity is negative, a, b, and c do not form a triangle, and the function should set A=1. The value of A should be returned by the function.110% Assignment 3- S4.pdf SalaryStmt.py Write a python program that accepts name of an employee and employee's yearly sales of last five years. The data should be collected for n employees. The value ofn should also be accepted as input. All amounts should be displayed with three decimal places. The output should be displayed as a table containing the Employee name, Average Sales and Bonus. The program must define and use a function with Total Sales as a parameter and should calculate the Average Sales and Bonus for each employee. Bonus must be calculated based on the following table: Average Sales (AS) ASAS<7500 75002AS<10000 AS210000SalaryStmt.py Write a python program that accepts name of an employee and employee's yearly sales of last five years. The data should be collected for n employees. The value of n should also be accepted as input. All amounts should be displayed with three decimal places. The output should be displayed as a table containing the Employee name, Average Sales and Bonus. The program must define and use a function with Total Sales as a parameter and should calculate the Average Sales and Bonus for each employee. Bonus must be calculated based on the following table: Average Sales (AS) AS<5000 Bonus 1% of Average Sales 2% of Average Sales 4% of Average Sales 7% of Average Sales 50002AS<7500 75002AS<10000 AS210000 Sample Output Employee Name Average Sales Bonus AFRAH 8577.000 343.080 ASMA 6476.800 129.536 ATHEER 4943.000 49.430 НАЈAR 10260.000 718.200 MALLAK 7876.600 315.064 MARYAM 6780.400 135.608 NOORA 8822.200 352.888 SAHAR 9126.800 365.072 SHEFAA 7631.000 305.240 TAGHARID 7580.400 303.216…
- SalaryStmt.py Write a python program that accepts name of an employee and employee's yearly sales of last five years. The data should be collected for n employees. The value of n should also be accepted as input. All amounts should be displayed with three decimal places. The output should be displayed as a table containing the Employee name, Average Sales and Bonus. The program must define and use a function with Total Sales as a parameter and should calculate the Average Sales and Bonus for cach employee. Bonus must be calculated based on the following table: Average Sales (AS) AS<5000 50002AS<7500 75002AS<10000 AS210000 Bonus | 1% of Average Sales 2% of Average Sales 4% of Average Sales 7% of Average Sales Sample Output ====: Employee Name Average Sales Bonus === AFRAH 8577.000 343.080 ASMA 6476.800 129.536 4943.000 10260.000 ATHEER 49.430 718.200 315.064 135.608 352.888 365.072 305.240 НАЈАR HAJAR 7876.600 6780.400 8822.200 9126.800 7631.000 7580.400 MALLAK MARYAM NOORA SAHAR SHEFAA…Using Python & import sys Create a program that has a function that takes as arguments a first and last name and creates a username. The username will be the first letter of the first name in lowercase, the last 7 of the last name in lowercase, and the total number of characters in the first and last names. For example, Eastern University would be eversity17. The program should print "Your username is x" where x is the username.LeakageDeduction.py Write a python program that calculates the salary deduction of an employee who spills more petrol. The program should accept previous reading, current reading and quantity of petrol loaded in n number of petrol pumps. The petrol price per gallon is fixed to OMR 0.180. The value of n must be accepted as input. The program must define and use a function to calculate the Leakage quantity and deduction amount. The Leakage quantity is calculated using the following formula: Leakage - Quantity loaded -(Current Reading - Previous Reading) The deduction amount is calculated by multiplying leakage with the rate of petrol per gallon. The company has declared not to deduct full amount from employee's salary due to pandemic. Following table must be used to find the actual salary deduction: Deduction Amount (DA) DA<10 102DA<20 202DA<40 402DA<50 DA250 Salary 10% of DA 20% of DA 30% of DA 40% of DA 50% of DA 6. |凶 B. N M.
- Task 13 Write a python function that will perform the basic calculation (addition, subtraction, multiplication and division) based on 3 arguments. They are: • Operator (+', '", ", *) • First Operand (any number) • Second Operand (any number) Your first task is to take these arguments as user input and pass the values to the function parameters. Your second task is to write a function and performs the calculation based on the given operator. Then, finally return the result in the function call and print the result ===== Input: "+" 10 20 Function Call: function_name("+", 10, 20) Output: 30.0Assignment 3 - S4.pdf 2/ 4 - 100% SalaryStmt.py Write a python program that accepts name of an employee and employee's yearly sales of last five years. The data should be collected for n employees. The value ofn should also be accepted as input. All amounts should be displayed with three decimal places. The output should be displayed as a table containing the Employee name, Average Sales and Bonus. The program must define and use a function with Total Sales as a parameter and should calculate the Average Sales and Bonus for each employee. Bonus must be calculated based on the following table: Average Sales (AS) AS<5000 Bonus 1% of Average Sales 2% of Average Sales 4% of Average Sales 7% of Average Sales 50002AS<7500 75002AS<10000 AS210000 e ll ENGLeakageDeduction.py Write a python programn that calculates the salary deduction of an employee who spills more petrol. The program should accept previous reading, current reading and quantity of petrol loaded inn number of petrol pumps. The petrol price per gallon is fixed to OMR 0.180. The vahue of n must be accepted as input. The program must define and use a function to calculate the Leakage quantity and deduction amount. The Leakage quantity is calculated using the following formula: Leakage = Quantity loaded - (Current Reading - Previous Reading) The deduction amount is calculated by multiplying leakage with the rate of petrol per gallon. The company has declared not to deduct full amount from employee's salary due to pandemic. Following table must be used to find the actual salary deduction: Deduction Amount (DA) Salary Deduction 10% of DA DA<10 102DA<20 202DA<40 20% of DA 30% of DA 40% of DA 50% of DA 402DA<50 DA250 Sample Inputs and Output PR Quantity Leakage Loaded CR…
- Use PYTHON to create a HANGMAN game: Your hangman game should be broken into appropriate functions, contain a main function, and do the following: 1.The program should randomly select a word from the list: kangaroo,capybara, wombat, koala, wallaby, quokka, platypus, dingo, kookaburra 2. Repeatedly prompt the user to guess a letter. 3.Validate the input 4. All guessed letters should be stored in a two-dimensional list (from problem 2). If the number of times a letter has been guessed is greater than 1, then the user should benotified that they have already guessed this letter and prompted to guess a different letter. The hangman won’t update (grow) if the same incorrect letter is guessed multiple times. 5. The word should be printed where all correctly guessed letters are revealed, and all unguessed letters are replaced with underscores 6. A hangman reflecting the number of incorrect guesses should be printed 7. If all the letters in the word are guessed, then the user wins. If…3. Write a PYTHON function called midpoint quad.py with signature def midpoint quad (func, a, b, N) #quad = midpoint quad ( func, a, b, N) # comments return quad where func indicates the name of a function, a and b are the lower and upper limits of integration, and N is the number of points, not the number of intervals. Test your midpointquad routine by computing f2rdx = 1. Even if you use only one interval (i.e. N = 2) you should get the exact answer because the midpoint rule integrates linear functions exactly. Use your midpoint routine to estimate the integral of the Runge function, f(x) = 1/(1+x2), over the interval [-5, 5]. The exact answer is 2 arctan (5). Fill in the following table, using scientific notation for the error values so you can see the pattern. Midpoint Result Error N h 11 1.0 101 0.1 1001 0.01 10001 0.001 Estimate the order of accuracy (an integer power of h) by examining the behaviour of the error when h is divided by 10. (In previous problems, we have estimated…Computer Science We are making n stone piles! The first pile has n stones. If n is even, then all succeeding piles will have an even number of stones. If n is odd, all succeeding piles will have an odd number of stones. Each pile must be more stones than the previous pile but as few as possible. Write a Python function to find and display the number of stones in each pile. The function should accept 1 argument that represents the initial number of stones in pile 1 and the number of piles to be generated.