3. Create a function in python that calculates the commission for a salesman based on the table below: Between $10,000 - $20,000 Between $20,000 - $30,000 $30,000 and over 2% of sale 3.5% of sale 5% of sale Allow the accounts clerk to enter the sales figures for the salesman. The output should read, "The sales commission is $..". (two decimal places).
Q: PROBLEM #3: Create a function which converts years into hours. The output should print like this for…
A: Write a python function which converts the number of years into number of hours. Example: 3 years =…
Q: Task 2: Create a program that accepts two numbers and determine the greatest common divisor (GCD) of…
A: 1. gcd with parameter a, b label loop: set temp := a set a…
Q: Write a function named times_ten. The function should accept an argument and display the product of…
A: Given: Write a function named times_ten. The function should accept an argument and display the…
Q: 2.a Fill in the function table below. The function volume() calculates the volume of a box (length x…
A: Function table Name Purpose Parameters Result Volume() Takes input values and…
Q: A “jiffy” is the scientific name for 1/100th of a second. Given an input number of seconds, output…
A: 1) Below is python program to output the number of "jiffies. for given input number of seconds It…
Q: Create a program in Python, called TA_Calculator, that uses a function to calculates the area of a…
A: Given: -
Q: a. The main part of the program will call a user-defined function. b. Inside the function do the…
A: Below I have provided Python Programming. Also, I have attached the screenshot of the code and…
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: (use Python)Use the Design Recipe to write a function called running_average that repeatedly asks…
A: Use an infinite loop to accept input and then specify condition to get out of loop
Q: Write a program whose inputs are three integers, and whose outputs are the largest of the three…
A: A Corel is a simple high level programming language. It is also used for making flowchart. We type…
Q: Given the following coding, fill in the blank with the "terms" of function as a comment. #include…
A: Given To complete the comment of the given function.
Q: This humorous chart from English National Opera (ENO) graphic uses questions to determine which…
A: def sociopath():str=input("Are you a…
Q: NEED CODE IN C++ IN VISUAL STUDIO AND OUTPUT Write a program to print the factorial of a number…
A: Sample Response: //C++ program of factorial #include<iostream> using namespace std;//main…
Q: LeakageDeduction.py Write a python program that calculates the salary deduction of an employee who…
A: SOURCE CODE: n=int(input("Enter number of employees:")) #read number of employees l=[] price=0.180…
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: Create the algorithm in both flowchart and pseudocode forms for the following two functions: A.…
A: 1. A) Function1: - #defining the function def calc_sales(a): #storing the inputted value…
Q: Write a complete python program that contains a function to calculate the average of : numbers. The…
A: Algorithm: Start Implement calculateAverage() which takes 5 numbers and prints average of 5 numbers…
Q: Define a function named get_user_number which has no parameters. When called, it gets a number…
A: A function is a block of organized, reusable code that is used to perform a specific task. It allows…
Q: a. The main part of the program will call a user-defined function. b. Inside the function do the…
A: The complete answer is solved using concepts of Function calls in the Python Programming.
Q: When it is 8:00 in Lubbock, • It is 9:00 in New York • It is 14:00 in London • It is 15:00 in Cairo…
A: NOTE - I have coded using the python programming language. Here I have taken input from the user.…
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: 5. Conversion Language: Python 3 G Autocomplete Ready O 1 > #Assume there are 30 days in each month…
A: First, we will call the main function. Then in the main function, we will input the no. of days.…
Q: Create a Python function, which using the information in the chart asks the correct questions to let…
A: I have answered this question in step 2.
Q: Create the following, in Python: You have a business that cleans floors in commercial space and…
A: Python Code :- import mathprint("Enter the floor length in feet ")a=int(input())print("Enter the…
Q: WHICH OPERA CHARACTER ARE YOU? Are you a sociopath? Yes No
A: Given:- This humorous chart from English National Opera (ENO) graphic uses questions to determine…
Q: (Use Python) Use the Design Recipe to define a function called bee_bop that consumes an integer…
A: for multiple of 2 take modulus with 2 and check if remainder is 0 and for 3 check if remainder is 0…
Q: /*12: Create a function named hello that has a $name parameter and outputs "Hello Dave!" when it is…
A: As per the requirement the program has been completed. Algorithm: Step 1: Start Step 2: Declare the…
Q: LeakageDeduction.py Write a python program that calculates the salary deduction of an employee who…
A: First we will calculate the leakage using the formula: Leakage = Quantity - (CR - PR) Then, we will…
Q: Four track athletes entered the mile race at the Manila Relays. Write a program that will read in…
A: In the given question we need to calculate speed from given time. If we know how far an item goes…
Q: 2. Write a Python program prompts the user to input number of hours worked, hourly rate and output…
A: Program Approach: Defining the method Calculating double overtime Calculating overtime Calculating…
Q: Write a C++ program that calculate and display the total fee for B.Sc. program in Engineering…
A: Code: #include <iostream>using namespace std; int calculateCourseFee(int ch,int fpc,int…
Q: Python XYZ store plans to give a festival discount to its customers. The store management has…
A: Given: Python XYZ store plans to give a festival discount to its customers. The store management has…
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: Write a program that takes 5 input numbers and outputs the mean (average)and standard deviation of…
A: As per the policy and guidelines of Bartleby we are supposed to answer only the first question or…
Q: Write a C++ program that calculate and display the total fee for B.Sc. program in Engineering…
A: Answer in step2
Q: Request a number from the keyboard. If the entered number is negative, this number is turned into a…
A: logic: Two functions used:- void calculate(int n) and void operation(int n) Here it is:- void…
Q: In python, Write a program that uses a custom function named as you wish and the main function. In…
A: The solution of above program, needs a function, with two arguments: one is string type and other is…
Q: A C++ program calculates the overall loan repayment amount to the bank, with a loan value of…
A: Algorithm : repay function : Step 1 : calculate the repayment according to the formula and store in…
Q: (Use Python) The function course_average should calculate and return the average of the three…
A: logic:- Input three grades and store values in variables. pass these values to course_average()…
Q: Assume you have a valid python function named ABC() that requires 2 arguments. Which of the…
A: The answer is...
Q: 3. Write a program that as the user to enter their 4 test scores. Based on their average test scores…
A: ANSWER:-
Q: NOTE: PYTHON CODE Create a python program that will overload a function named linechar that display…
A: Algorithm: Start Overload linechar() methods where one method takes no argument, one method takes…
Q: 2. Create a function that will input 10 numbers and will perform the following 1. Display all even…
A: As per the requirement program is developed. Note: Here in the question programming language is not…
Q: Code should be in Python, please 1. Write a program with a car's miles/gallon and gas…
A: According to the provided information: We need to create a python function that will take input…
Q: Prompt the user to enter an integer p and then pass this integer to a function named getPow4 which…
A: Given: An integer p entered by the user. Requirement: Write a C++ program to take input value of p…
Q: Write a Python program to take five test scores from the user and calculate the average score.…
A: Program Approach - Prompt user to enter the five scores of the test. Calculate the total of all…
Q: 2. Complete a program below. The program will read base and height values of a cylinder from the…
A: First declare all the function required and then define it.
Q: Program 2: Write a Python program to accept employee name and basic salary of n number of employees…
A: # Method for Calcualting Allowanancedef calculate_allowance(basic_salary): """returns allowance…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Mark the following statements as true or false: a. To use a predefined function in a program, you need to know only the name of the function and how to use it. (1) b. A value-returning function returns only one value. (2, 3) c. Parameters allow you to use different values each time the function is called. (2, 7, 9) d. When a return statement executes in a user-defined function, the function immediately exits. (3, 4) e. A value-returning function returns only integer values. (4) f. A variable name cannot be passed to a value parameter. (3, 6) g. If a C++ function does not use parameters, parentheses around the empty parameter list are still required. (2, 3, 6) h. In C + + , the names of the corresponding formal and actual parameters must be the same. (3, 4, 6) i. A function that changes the value of a reference parameter also changes the value of the actual parameter. (7) j. Whenever the value of a reference parameter changes, the value of the actual parameter changes. (7) k. In C++, function definitions can be nested; that is, the definition of one function can be enclosed in the body of another function. (9) l. Using global variables in a program is a better programming style than using local variables, because extra variables can be avoided. (10) m. In a program, global constants are as dangerous as global variables. (10) n. The memory for a static variable remains allocated between function calls. (11)(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.4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }
- (Practice) For the following function headers, determine the number, type, and order (sequence) of values that should be passed to the function when it’s called and the data type of the value the function returns: a. int factorial(int n) b. double volts(int res, double induct, double cap) c. double power(int type, double induct, double cap) d. char flag(char type, float current, float time) e. int total(float amount, float rate) f. float roi(int a, int b, char c, char d, float e, float f) g. void getVal(int item, int iter, char decflag, char delim)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.Do not use global variables for this assignment Choose descriptive variable names in all programs. Currency format. There should be no space between the $ sign and the first digit. In python, Write a program that uses a custom function named as you wish and the main function. In main, prompt the user for a first name and an integer less than 10 and then execute the custom function with these two inputs as arguments. The custom function should output one line displaying the name as many times as specified by the integer, separating each repetition of the name with a space.
- 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.0LeakageDeduction.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…Question 1 Write a function to print “hello_USERNAME!” USERNAME is the input of the function. The first line of the code has been defined as below. def hello_name(user_name): ..... Question 2 Write a python function, first_odds that prints the odd numbers from 1-100 and returns nothing def first_odds(): ..... Question 3 Please write a Python function, max_num_in_list to return the max number of a given list. The first line of the code has been defined as below. def max_num_in_list(a_list): ..... Question 4 Write a function to return if the given year is a leap year. A leap year is divisible by 4, but not divisible by 100, unless it is also divisible by 400. The return should be boolean Type (true/false). def is_leap_year(a_year): ..... Question 5 Write a function to check to see if all numbers in list are consecutive numbers. For example, [2,3,4,5,6,7] are consecutive numbers, but [1,2,4,5] are not consecutive numbers. The return should be boolean Type. def…
- Question 1 Write a function to print “hello_USERNAME!” USERNAME is the input of the function. The first line of the code has been defined as below. def hello_name(user_name): ..... Question 2 Write a python function, first_odds that prints the odd numbers from 1-100 and returns nothing def first_odds(): ..... Question 3 Please write a Python function, max_num_in_list to return the max number of a given list. The first line of the code has been defined as below. def max_num_in_list(a_list): ..... Question 4 Write a function to return if the given year is a leap year. A leap year is divisible by 4, but not divisible by 100, unless it is also divisible by 400. The return should be boolean Type (true/false). def is_leap_year(a_year): ..... Question 5 Write a function to check to see if all numbers in list are consecutive numbers. For example, [2,3,4,5,6,7] are consecutive numbers, but [1,2,4,5] are not consecutive numbers. The return should be boolean Type.Code should be in Python, please Toll roads have different fees based on the time of day and on weekends. 1. Write a function calc_toll() that has three parameters: the current hour of time (int), whether the time is morning (boolean), and whether the day is a weekend (boolean). The function returns the correct toll fee (float), based on the chart below. Weekday Tolls Before 7:00 am ($1.15) 7:00 am to 9:59 am ($2.95) 10:00 am to 2:59 pm ($1.90) 3:00 pm to 7:59 pm ($3.95) Starting 8:00 pm ($1.40) Weekend Tolls Before 7:00 am ($1.05) 7:00 am to 7:59 pm ($2.15) Starting 8:00 pm ($1.10) Ex: The function calls below, with the given arguments, will return the following toll fees: calc_toll(8, True, False) returns 2.95calc_toll(1, False, False) returns 1.90calc_toll(3, False, True) returns 2.15calc_toll(5, True, True) returns 1.05Using 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.