Write and execute a program to do the following: - 1) Ask the user the user to input marks in integer for 10 students. You can use the following marks as initial values 2) Define a function that takes an integer mark and returns its letter grade according to the following table :- Grade A Mark 90 s mark 80s mark< 90 60 s mark< 80 mark < 60
Q: Question 2: Write a program that defines a function, RoundToThousands(number), to round a number x…
A: Step 1:- Program Approach:- 1.Declare the user-defined function that function takes one parameter.…
Q: function_1 is a function as follows. What is the value of a at the end of the code ? function a =…
A: Lets analyse the given code: function a = function_1(a)%takes variable a from function…
Q: Assume a function F1 is de double b1, double t1[50]; A cout << F1(int a1, d B cout << F1(a1, b1, t…
A: Below is the simplified solution to the above listed MCQ statement:
Q: Create a function that takes one, two or more numbers as arguments and adds them together to get a…
A: Step 1 Logic 1. created the Method with the argument 2. n= n = args.reduce((a,b) => a + b) 3.…
Q: 3. Twin Primes A prime number is any integer greater than 1 that is divisible (without remainder) by…
A: Program: def twinPrimes(a,b):t=[]while a<=b:if a==1 or a==2:a+=1continueif isPrime(a):if…
Q: 4. Write a function to compute the following: i.e. the area and perimeter circle as given below. No…
A: import math #to use value of pidef areaperi(r): area = math.pi*r*r perimeter = 2*math.pi*r…
Q: Write a function that displays all the numbers between two integers in n lines, that are divisible…
A: Required: Write a function that displays all the numbers between two integers in n lines, that are…
Q: Write a function double paymentDue (double price) which accepts the price of an item and returns the…
A: I have provided a solution in step2
Q: Create a function that takes one, two, or more numbers as arguments and sums them to get a new…
A: 1. created the Method with the argument 2. n= n = args.reduce((a,b) => a + b) 3. iterating loop…
Q: Print a function display_square(n) that prints a square of asterisks as shown in the example table…
A: I created the function in python and provide the code, output screenshot, and code screenshot refer…
Q: 6. Suppose, user will provide you the length of 3 sides of a triangle. Now, create a function that…
A: The answer is given below:-
Q: Write a function named min that accepts two integer values as arguments and returns the value that…
A: Solution :
Q: . Create a function that accepts two numbers as input arguments and returns one with the larger…
A: clc; clear all; x=large_absolute(-9,-6); %calling function large_absolute with 2 arguments to…
Q: Question 5 In the following lines of code, in what line number does the function end? (1) def…
A: The function ends at line 2, that is, return ((a ** 2) + (b ** 2)) ** 0.5, the statement where the…
Q: The following function is defined on the set of integers. Write a program, that calculates the…
A: I have given an answer in step 2.
Q: Write a function that will take in a number of weeks and a number of days and return the total…
A: Given:
Q: 2. Write a program that accepts the price of a meal and the tip percent as a whole number. The…
A: read sale price of meal read tip percent calculate tip amount=sale price*tip/100 display sale amount…
Q: 1) Write a function declaration for a function named divide: a) Accept two numbers as input…
A: function divide(float num1, float num2): Start return num1/num2 Stop function main: Start declare…
Q: Create a function that takes three collections of arguments and returns the sum of the product of…
A: function product(x1, y1) { return function(x2, y2){ return function(x3, y3){ return x1 * x2 * x3…
Q: Write a function that returns the power of 2 (x) of a given number, keep asking the user to enter…
A: Please find the answer below :
Q: Write a function that prompts the user for the base and the height of a triangle and then proceeds…
A: To find area of the triangle, in python with length of height and base given, we need to first take…
Q: 6. Write a program to do the following:- 1) Define the function BasicAllowanceCalc that takes the…
A: Given:- a function named BasicAllowanceCalc() that take argument salary in float…
Q: 2. Write a function named “MyInfo ()". Now pass three parameters to your function i.e. your name,…
A: Please find the answer below :
Q: Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the…
A: A C++ program for the given criteria is as follows, File name: “main.cpp” #include <iostream>…
Q: 2) Write a general program that takes an integer value from the user. Then generates a Prime…
A: #include<iostream> #include <cmath> using namespace std; // function to calculate and…
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 two functions that implement the following conversions: a. Function celsius receives a…
A: Program: #include<bits/stdc++.h> #include <iostream> using namespace std; float…
Q: Create a function that takes one, two or more numbers as arguments and adds them together to get a…
A: 1) Since you have not specified programming language, I have written program in python 2) Below is…
Q: Create a function that takes one, two or more numbers as arguments and adds them together to get a…
A: So, to solve the problem I am using JavaScript programming language. Program input: function…
Q: In this question you need to write a program and execute it with the given input, the output of your…
A: Islamic year for the Gregorian year 1946 is 1364.
Q: In Python: Write a function called pizza_cost that returns the cost per square inch of a circular…
A: Code: def pizza_cost(p,d): r=d/2 area=3.14*r*r cost_sqinch=p/area return cost_sqinch def…
Q: 3. Write a function which will take 3 arguments minimum, maximum and divisor. You have to find all…
A: the answer is given below:-
Q: write a program that asks the users to input three numbers (x,y,z) and calculate the sum,…
A: Dear Student, as no language was mentioned I have done the program in c++
Q: Write a python program that takes in name and pay rate and the number of hours worked in a week by…
A: Algorithm : main function() Step 1 : setting number of persons(3) to a variable. Step 2 : declaring…
Q: (Format an integer) Write a function with the following header to format the inte- ger with the…
A: Given: (Format an integer) Write a function with the following header to format the inte- ger with…
Q: Write a function that takes a gross salary and calculates the net salary by deducting: • 7.65%…
A: PROGRAM: #include<stdio.h> //Defining the method to calculate the net salary with parameters…
Q: Write a function that takes one integer argument and returns the sum of all numbers from 1 to the…
A: Write a function code in Python Programming language which takes an integer as parameter and prints…
Q: A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number…
A: Note : In Python programming indentation is important. Step 1: Start Step 2: Create a function…
Q: Write a function called TRIA that calculates the area of a triangle. It should have 2 inputs and one…
A: We are going to write a function which can be called from main and it will calculate the area of the…
Q: Define a function print_feet_inch_short(), with parameters num_feet and num_inches, that prints…
A: According to the information given:- create a function:- print_feet_inch-short() parameters…
Q: 2. Write a function named "MyInfo ()". Now pass three parameters to your function i.e. your name,…
A: Step 1:- Program Approach:- 1.Declare the function whose name is MyInfo and this function takes 3…
Q: Write a function that receives 5 integers and returns the sum, average and standard deviation of…
A: EXPLANATION - Take 5 number from user as input . Pass number as parameter in func and call func . In…
Q: Write a function print_rainfalls(rainfalls) that extends the earlier print_daily_totals(rainfalls)…
A: GIVEN:
Q: 1)Write a function in Python that takes four parameters a, b, c and n and then checks to see if…
A: python code is given below:
Q: Write a function that takes one argument, an integer, and returns the value of the following 1117…
A: Below I have provided a python program for the given question. Also, I have attached a screenshot of…
Q: Using a script (code) file, write the following functions: Write the definition of a function that…
A: Given: We have to write a Python program Using a script (code) file, write the following…
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…
Q: Write a function that returns the sum of multiples of 3 and 5 between 0 and 20. It should return the…
A: I have given an answer in step 2.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
- (Physics) Buoyancy is the upward force a liquid exerts on a submerged object, as shown in Figure 6.9. The buoyancy force is given by this formula: B=pgV Bisthebuoyancyforce( lbforN).isthefluiddensity( slug/f t 3 orkg/ m 3 ).gistheaccelerationcausedbygravity( 32.2ft/se c 2 or9.8m/ s 2 ).Vistheobjectsvolume( f t 3 or m 3 ). a. Using this formula, write a function named buoyantForce(double ro, double vol, int units) that accepts a fluid density, the volume of an object placed in the fluid, and the units to be used(1=U.S.Customaryunits,2=metricunits), and returns the buoyancy force exerted on the object. b. Include the function written for Exercise 6a in a working C++ program, and use your program to complete the following chart: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) a. The following is an extremely useful programming algorithm for rounding a real number to n decimal places: Step 1: Multiply the number by 10n Step 2: Add 0.5 Step 3: Delete the fractional part of the result Step 4: Divide by 10n For example, using this algorithm to round the number 78.374625 to three decimal places yields: Step1:78.374625103=78374.625 Step2:78374.625+0.5=78375.125 Step3:Retainingtheintegerpart=78375Step4:78375dividedby103=78.375 Using this algorithm, write a C++ function that accepts a user-entered value and returns the result rounded to two decimal places. b. Enter, compile, and run the program written for Exercise 11a.
- (Time in Seconds) Write a function that takes the time as three integer arguments (forhours, minutes, and seconds) and returns the number of seconds since the last time the clock “struck12.” Use this function to calculate the amount of time in seconds between two times, both of whichare within one 12-hour cycle of the clockchange.py Create a program, change.py, that has a function that takes 5 arguments thatcorrespond to the number of $1 dollar bills, quarters, dimes, nickels, andpennies, respectively. Calculate the total value of that change, and print "Thetotal value of your change is $x" where x is equal to the total value.Write a function named midvalue that is passed three unique int values and returns the one that is in the middle. Thus, midvalue(5,28,14) returns 14.
- A bank charges $10 per month, plus the following check fees for a commercial checking account: $0.10 each for less than 20 checks $0.08 each for 20 through 39 checks $0.06 each for 40 through 59 checks $0.04 each for 60 or more checks Write a function BankCharges() that allows the user to enter the number of checks written and computes and displays the bank’s service fees for the month. All checks for the month are assigned the same charge, based on the total number of checks written during the month. Use the following test data to determine whether the application is calculating properly. In each case, the customer is charged only a single rate, based on the total number of checks. Your solution should clearly show the function. Customer Number of Checks Bank Charges Nancy 15 Lilian 25 Arianna 45 Ben 75Write two or more function, parameters and arguments that generates a random license plate. Your function should have approximately equal odds of generating a sequence of characters for an old license plate or a new license plate. Write a main program that calls your function and displays the randomly generated license plate.What is the output of the code below? def mystery_func(input, num, t = 0, x = 10, y = 10)[this function multiples all arguments together (except t) and raises the result to the power of t and returns this]print(mystery_func(2, 3))
- “Days Into Year (C++)” By using my code (photo is attached), implement a Days Into Year function. It MUST BE of this form: int daysIntoYear ( int year, int month, int day ) ; In terms of "Days Into Year," how many days are we into the year based on a given date? For example, January 1 is 1 day into the year. Please have the code display 12 test cases with the result from the function, and the number of days into the year from some other source. So you can hand calculate the days into the year or use an internet web page. The typical output might look like this: (Please make the format better but be sure to automatically calculate agree/disagree column) You must include a leap year function that returns a bool and takes as a parameter the year. This function must be used in your code. Year Month day Days Into Year Value expected Agree/Disagree 2020 1 1 1 1 agree 2020 1…c++ Write a function that will generate a random number between 1 and 100. Then it ask the user to guess a number between 1 and 100. If the user’s entry is equal to the random number, it will display “You are a winner”; otherwise, it will display: “You did not win”(Multiples) Write a function isMultiple that determines for a pair of integers whether thesecond integer is a multiple of the first. The function should take two integer arguments and return1 (true) if the second is a multiple of the first, and 0 (false) otherwise. Use this function in a programthat inputs a series of pairs of integers.