3. Write a function called e2_age_range that computes how many people fall within a certain age range. The first input, A, is a matrix of non-negative integers specifying the ages of a group of people. The second input, called min_age, is the age the included people must be older than. The third, max age, is the age the included people cannot be older than. The function returns the number of people that fall into the specified range. You are not allowed to use loops. Here are some example runs: > e2_age_range ([12 8 22 18 17 3 4 33],0,17) ans = >> e2_age_range (1:100,90 ,100) ans = 10 > e2_age_range ([1 3 5 7 9],5,6) ans =
Q: FoodPanda delivery service wants to appraise their riders by adding increments to the basic…
A: #include <iostream> using namespace std;float calculatebonus(float b, float base){ float…
Q: 1. There is a field with a shape of a rectangle. Trees will be planted to all sides of this field.…
A: Read the values for length and breadth of the field. Now find the number of trees that are planted…
Q: Create a type slidingTile, consisting of a char matrix and two integers x and y. The integers x and…
A: It is defined as a general purpose programming language with an emphasis on expressiveness and…
Q: # Exercise 1e: Create a function within a function # Create a function for adding 2 numbers,…
A: def addition(n1, n2): print("Adding", n1, "and", n2, ":", (n1+n2)) def subtraction(n1, n2):…
Q: 4. This function takes 2 parameters, your paycheck and the % tax taken out of the paycheck. // 50%…
A: function taxesSuck(paycheck, taxPercent){ var reduced_paycheck =0; var necessities = 0; var…
Q: Write a function potentialcontacts (person_a, person_b) that identifies all of the potential…
A: Program Approach: In this python code three methods "add_time, convert_to_minutes, and…
Q: 4) Write a function that receives a vector of characters and reverses the contents of the provided…
A: Given:
Q: Define a function game_result(move1, move2) that takes two string parameters. If move1 wins return…
A: Below is the code in python with sample output:
Q: Write a user-defined function that calculates the price of 1g of each product in AED as following:…
A: I am providing C++ code that calculates the price of Ixg of each product in AED as follows:
Q: 4.16 LAB: Toll calculation Toll roads have different fees based on the time of day and on…
A: Program Explanation:- If time is before 7. If the time is after 8 not in the morning. If the time…
Q: Write the definition of the function inputArray that prompts the user to input 20 numbers and stores…
A: Given: Write the definition of the function inputArray that prompts the user to input 20 numbers…
Q: Q1: Write a computer program in F90 to generate a matrix A(n) which contains a real numbers…
A: Code in step 2
Q: Using C++, take a number from the user between 1 and 10 and create a vector consisting of numbers up…
A: Please give positive ratings for my efforts. Thanks. ANSWER #include<bits/stdc++.h>…
Q: Consider the provided function main in main.cpp: Write the definition of the function inputArray…
A: The below-given program will obey the following rubrics: Importing necessary header files.…
Q: A matrix named mach contains three columns of data concerning the energy output of several machines.…
A: JAVA programClass name is Matrix. It contains function named Transfer.Create a matrix named mach of…
Q: Question 4 The following function: rpad ('CIT', 5, '.'); would return: A) 'CIT...' ' B...CIT 'CIT..'…
A: 1) rpad function is used to padding the right side of a string with a specific set of characters.…
Q: Language C++ Write a function to find the norm of a matrix. The norm is defined as the square root…
A: The Norm of a matrix is defined as the square root of a sum of the squares of all elements in the…
Q: Brittany wants to identify employees who are eligible to take a CPR course at the clubs' expense.…
A: Required : Formula for the given scenario.
Q: Write a function named lowerLeftQuarter that takes one argument, a matrix. The function then returns…
A: Since no programming language is mentioned, I am using matlab Code: lowerLeftQuarter([1 2 3 4;5…
Q: Consider the provided function main in main.cpp: Write the definition of the function inputArray…
A: A C++ program is as follows, File name: "main.cpp" #include<iostream> using namespace std;…
Q: Create a function that automatically make sentences from a subject, be (already conjugated), a verb…
A: """Program to define a function to print sentance based on subject, be and verbs""" #function that…
Q: "C" to add $100 in the balance of all the customers having more than $1000 in their balance and then…
A: The following code is in 'C' language:
Q: 4) Write a function called divide_dataset_into_training_and testing as shown below that aims to…
A: train_test_split is a function in Sklearn model selection for splitting data arrays into two…
Q: Q3: a- Write a program to pass a two dimensional square matrix as a parameter to a function; this…
A: Solution in c++
Q: 2) C++ Program Hard code the following 3x3 matrix of integers into your code: 1 2 3 6 4 6 3 4 3 Now…
A: C++ will be used to answer the question
Q: With the help of c++, write a code that permits a user to input the surnames of 5 students. A…
A: In step 2, you will the C++ code. In step 3, you can see the sample output. In step 4, you will get…
Q: 1. Write a function with vector as it's parameter. The function will accept names (full names:…
A: As per the qna policy, only first question is solved. Since you have not specified the programming…
Q: Listing 4.7, ComputeTax.py, gives a program to compute tax. Write a function for computing tax using…
A: Declare a variables initial = 50000, and final = 60000 and the interval = 50 Call the function def…
Q: Write a function dispense_bills(). The function determines the minimum number of bills to dispense…
A: C program that demonstrates the function, dispense_bills . The program prompts the user to enter the…
Q: Write a MATAB function will return the distance between two vectors of arbitrary dimensions. Inside…
A: MATLAB CODE : % function to find the distance between the two city and also we validate % the…
Q: Q3: a- Write a program to pass a two dimensional square matrix as a parameter to a function; this…
A: sample output
Q: 3) A function called isMagic is written below, your task is to write two of the helper functions…
A: Answer :
Q: Write a stored function that takes the name of the city where the patient lives. The value return…
A: solution are given below
Q: (a) Write an R function that accepts the age of a person and then classifies the person into an age…
A:
Q: use c code to develop the condition and function for the following items and then redevelop the code…
A: NOTE: - TO return value from the function, the function header must have a return type instead of…
Q: 1. Write a function with vector as it's parameter. The function will accept names (full names:…
A: Note: Answering the first question as per the guidelines. Input : Input given name, middle name,…
Q: Compute and print the sum and average of a collection of floating-point data items numItems,…
A: - We need to highlight the code for the provided scenario of finding the sum and average of the…
Q: FoodPanda delivery service wants to appraise their riders by adding increments to the basic…
A: float calculateBonus(float salary, float points){ float bonus; if(points>800) bonus=10;…
Q: Describe the input, process and output of the following function. void reserveroom(vector&…
A: Input: It accepts a vector of HotelRoom type as input argument, the number of the user's…
Q: Question 6: Write a function that receives 3 assignment grades, al, a2, a3, and a final grade, f,…
A: The main objective of the python program is to write the function, compute_letter . The function…
Q: 1. Give 2 examples of numeric functions and write general purpose of them to use.
A: Just as is the case for other programming languages, such as C++ or S-Plus, a SAS function is a…
Q: 3. Write a function with vector as it's parameter. The function will access all names and extracts…
A: For this function we need to firstly store input and then convert all names to vector, then pass…
Q: C++ 1. Create a vector of 100 randomly generated integers. Use the count_if function and a lambda…
A: Answer
Q: Create a function named mat_operations() that takes in two matrices a input parameters it should: 1.…
A: Advantages of flow chart: The flowchart provides a concise presentation. The flow chart gives…
Q: Write a function that updates the year of a student, i.e. if year is “Year1”, then update to…
A: Code: #include <iostream>#include<cstring>using namespace std;//require function…
Q: 1. (Random Integer Matrices) In this question, you'll make a function which produces three random…
A: the answer is given below: three_mats function
Q: A student has a number of attributes including: stName, stNo and stMark If we have a LIST of 4…
A: we have to write a program where it will accept 4 students and find out the student name and marks…
MATLAB Question:
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- To convert between Celsius and Fahrenheit, the following formula is used, where C = Celsius temperature and F = Fahrenheit temperature: C = 5/9 * (F-32) Write a C++ temperature conversion program which does the following: Write a function called toCelsuis which takes a Fahrenheit temperature as a parameter, and returns the equivalent Celsius temperature: float toCelsius(float) Demonstrate that your function works by writing a main() function that prints out a conversion table. It should have Fahrenheit values 60, 61, 62, ... through 80 (21 temperatures in total) and should also have the corresponding Celsius temperatures that your function calculated. So your output should look something like this (with 21 temperature conversions total, I used ... to save space here for most of them): Welcome to the temperature table!F C60 15.661 16.1... ...80 26.7 If you like: you can add this line in your function to make floating point output fixed, make sure you…(a) Write the C++ function, operator+(const Matrix& b) const, which returns the matrix *this + b.Write a function dispense_bills(). The function determines the minimum number of bills to dispense given a withdrawal amount. The possible bills dispensed include: 50’s, 20’s, and 10’s. The number of each bill to dispense should be stored indirectly through the pointers: fifties_ptr, twenties_ptr, and tens_ptr. If the withdrawal_amount exceeds the balance, then the number of each bill to dispense should be set to 0, and 0 should be returned. If the withdrawal_amount is less than or equal to the balance, then the number of each bill to dispense should be calculated, and 1 should be returned. The function header has been provided for you. // precondition: withdrawal amount must be a multiple of 10 // return: 1 if the balance >= withdrawal_amount; 0 otherwise int dispense_bills(double balance, double withdrawal_amount, int *fifties_ptr, int *twenties_ptr, int *tens_ptr) { }
- Age information for 100 families of 4 people is defined as members of a community. For every family, Send the age of each family member to a function called average (), where the average is after calculating, send the address of the average information to the main() function, main the function prints, Send the addresses of parents ' age information to function1 (), in the function, it checks whether the ages of the mother and father are double, and each if the age of both is even, it returns a value of 1 from the function, otherwise a value of 0,write a C program.we will write a function to compare the suitability of various alien planets for a space colony. Make up the names of 5 alien planets and enter these in cells B5–B9 of Sheet 1 in your file. For each planet make up in the same row of the sheet a temperature (between -200 and +200) in column C, an oxygen percentage (between 0 and 100) in column D, and a radiation level chosen from “None”, “Low”, “High”, and “Lethal” in column E. Write a function which takes as input a planet name and returns a message as follows: • If the planet is not on the list then return “Pick another planet”. • If the temperature is less than -80 or greater than +80, or the oxygen level is less than 10, or the radiation level is Lethal, return “x is not habitable” where x is the name of the planet.Assume that we have a function "double getDistance(struct point p1, struct point p2)" that calculates the euclidian distance (straight line distance) between point p1 and p2. The point structure has two floating point variables x and y. You need to write the getDistance function here?
- Hello, I need help please because I am trying to make a function that will count the wins of a team and output the wins. The function prototype is unsigned wins(); It takes no parameter and it shall search the games_ vector and return the number of wins. Were supposed to not use the [] operator, but I dont know how else to do it. Here is my code for context: TEAMS.H FILE #ifndef TEAMS_H#define TEAMS_H#include <vector>#include <iostream>#include <string>#include "Game.h"using namespace std; class Teams { private: string team_name_; vector <Game> games_; public: Teams(const string& new_team); void addGame(const string&, const string&); void removeGame(const string&); void updateScores(const string&, unsigned, unsigned); unsigned wins(); friend ostream& operator<<(ostream&, const Teams&);};#endif TEAMS.CPP FILE: #include <iostream> #include <vector>#include <string>#include "Teams.h"…4.16 LAB: Toll calculation Toll roads have different fees based on the time of day and on weekends. 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.054. Write a function called electionResults() that takes 2 lists as parameters. Thefirst list contains the names of political parties, in a given order; the second contains, inthe same order, the vote total each party received in a local election. Your function should print the name of each party followed by the word “Party”, in a column 30characters wide; the number of votes each received in a column 10 characters wide; andthe percentage of the vote each received in a column 10 characters wide, rounded to 2decimal places, followed by the percent sign ‘%’. (Vote totals may not add to exactly100.00% because of rounding.)>>> electionResults(['Sensible', 'Silly', 'Very Silly'], [29412,29397, 37])Sensible Party 29412 49.98%Silly Party 29397 49.96%Very Silly Party 37 0.06%
- Please provide step by step solution with a proper explanation. C++ Question: Write a function named "countGrades" that will accept a count as the total number of grades to be read in by the function. After reading the list of grades, it will return the following statistical data for that list of grades: - how many grades are passing ('A' or 'B' or 'C') - how many 'A' grades - how many invalid grades (not 'A', 'B', 'C', 'D' or 'F') For example, if the user passes in 1 and enters 'A', it will return 1, 1, 0 If the user passes in 3 and enters 'A', 'B', 'C', it will return 3, 1, 0 If the user enters in 5 and enters 'A', 'B', 'C', 'X', 'A', it will return 4, 2, 1‘Write a function get_names(), which prompts the user for a sequence of names, where each name can contain an arbitrary mix of uppercase and lowercaseletters and space characters, until the user enters "exit". The function should then return a list of capitalized names, whith no leading or trailing space, and with‘one space character separating adjacent words, Write a main() function to test the get_names() function. For example: Enter a name (exit to stop): bill clintonEnter a name (exit to stop): john tigER sMith Enter a name (exit to stop): mary beautiful Graceland Enter a name (exit to stop): exit [Bill Clinton’, “John Tiger Smith’, ‘Mary Beautiful Graceland’ ]ASSIGNMENT Consider the following function. What is the purpose of the function f? Please do explain and describe in details all possible answers for this function given below.int f(int n) {if ((a >= b) && (c < b)) return b; else if (a >= b) return f(a, c, b); else return f(b, a, c);} To find the maximum number between a, b, and c. To find the middle number between a, b, and c. To find the minimum number between a, b, and c. None of the other statements. Suppose the letters a,b,c,d,e,f have probabilities of 1/2, 1/4, 1/8, 1/16, 1/32, 1/32 respectively. Which of the following is the Huffman code for the letter a,b,c,d,e,f? Please show how is the Huffman tree, so that you can determine one of the options below. 0, 10, 110, 1110, 11110, 11111 11, 10, 01, 001, 0001, 0000 11, 10, 011, 010, 001, 000 110, 100, 010, 000, 001, 111 An adjacency matrix of a graph is given below: matrix at photoFirst, draw the graph defined by that adjacency matrix, and label the…