Write a user defined function called PluralizePlant
Q: Write a function named "CompareTwo" that accepts four parameters:: A1: array of type integer. A2:…
A: string CompareTwo(int A1[],int A2[],int S1,int S2){ int sum_of_a1=0,sum_of_a2=0,i;…
Q: Create a function that returns the lowest neighbor of a given (x, y) coordinate element in a 2D…
A: function lowestElement(arr, x, y) { let from = !y ? y : y - 1 let to = y + 2 let check = [] for(let…
Q: Write a function called countLastE( ) that takes two arguments. The first argument is an "array of…
A: Program: #include<stdio.h> #include<stdlib.h> #include<string.h> struct student{…
Q: Write a program that declares/intializes two arrays as described in main() and has two functions.…
A: C++ Code: #include<iostream>#include<string.h>using namespace std; //This function…
Q: C++ Write a function named “getTotalHourAndPayout” that accepts an array of PayStub object pointers…
A: Code in c++: #include <bits/stdc++.h> using namespace std; void getTotalHourAndPayout(int n,…
Q: Write a function called double getAverage(int *array, int SIZE), where it accept the array as…
A: Question has asked to write a function in C++ called double getAverage(int *array, int SIZE)…
Q: Write a function called checkArray that takes an array of 20 integer elements as its argument and…
A: Please refer below code and output: Language used is C++: #include <iostream> using…
Q: Is program will make use of two arrays, each of which can contain 6 integers, Write a program that…
A: #include <iostream>using namespace std; void inputData(int array[6]) { for(int i = 0; i <…
Q: Create a function named "justEmails". The function should accept a parameter for JSON data named…
A: 1. Create a new function a. declare a empty array b. declare a new…
Q: lay the sorted list. Another function should be called that calculates the average score and display…
A: Code: #include<iostream>using namespace std;int n; //global variable for number of…
Q: For this C++ called getArrayLength that counts up the number of elements in an array of integers…
A: Please find the answer below :
Q: Write the C function that will add a value to the end of the array field arr into the structure for…
A: C program to add a value at the end of the array field and to double the size of memory is below
Q: 1)Write a function that takes 2 strings, word1 and word2 as parameters. The function must return if,…
A: Actually, function is a group of statements.
Q: Write a C++ console application that allows your user to capture rainfall statistics. Your program…
A: The C++ program and approach are given below:Approach:Declaring the essential headers and the…
Q: Write a program which has a class called Character and data member which is a pointer to a…
A: First, let's understand what is a linear search to find an element in an array of size n. It…
Q: Creates an array large enough to hold 1000 stocks. Repeatedly asks the user for a tickerName,…
A: Explanation: Include the necessary header files. Then create a class order with data members'…
Q: Write a function named "isBoundedArray" that accepts an array of integers and its size. The function…
A: CPP Code:- #include<iostream> using namespace std; //This is isBoundedArray() function, it…
Q: Write a program that creates a two-dimensional array initialized with test data. Use any data type…
A: The Following Integer array is used as Test Data to perform the given operations on the Array : int…
Q: Write a function called displaylnfo() that will receive the array and the number of elements in the…
A: The required C++ code is: #include<iostream>#include<iomanip>using namespace std;struct…
Q: In a program, write a function named largerThanN that accepts three arguments: an array of type int,…
A: To solve the given task we need to implement the largestThanN () function and in the main we call…
Q: I need a C code of this: Implement the following functions: void createArray(int arr[],int…
A: Find the sum and reduce the minimum for finding father and reduce maximum for finding son
Q: Write a function mean_filter(img, s) that takes as its first argument a 2-dimensional numpy array…
A: Note : Answering in python as no programming language is mentioned. Input : Input image Input size…
Q: In LineArrayBag, add a function named addBefore. This function accepts two Line objects as input:…
A: We need to write a class LineArrayBag which has a function named addBefore, that accepts two…
Q: Create a function that takes two numbers as arguments (number, length) and then returns the list of…
A: In this problem we need to desgin a method to return the multiple of a number for a count. In…
Q: Write a function called "AddRows" that accepts two parameters: W1: a matrix of size 7x4 elements of…
A: Code: #include<stdio.h>main(){ int m[7][4]; int a[4]; int i,j,k; for(i=0;i<7;i++) {…
Q: Write a function called agesToMinutes that, * accepts an array of object as parameter and * return…
A: function agesToMinutes(arr) { return arr.map(function(ele) { return { name:…
Q: Write a function named "SumPositive" that takes the following arguments: an array of integer values…
A: We need to check for every array element whether it is a positive number or not. If the number is…
Q: Write a function sumArray with: • Inputs o the first input is an int array called inputArr o the…
A: Given :- Write a function sumArray with:Inputs the first input is an int array called inputArr the…
Q: please can you help fix my code TypeError: 'NoneType' object is not callable import timeit import…
A: Required: please can you help fix my code TypeError: 'NoneType' object is not callable Note: below…
Q: Write a program that populates an integer array with six random numbers provided by the user. Your…
A: //C++ code given in next step
Q: need to create a function that replicates Python's filter function # This method creates a new…
A: Program Plan: Define class demo that creates dynamic arrays. Create a constructor to initialise the…
Q: Write a function called displayTotalHours() that will receive the array and the number of elements…
A: As the programming Language not mentioned, I have written in most easy language i.e. JavaScript. If…
Q: C++ Write a function named “checkInvalidHours” that accepts an array of PaySub objects and its…
A: The solution in C++ is as follows for size of 5.We can change the size as per our requirement
Q: Write a program that displays the name of each month in a year and its rainfall amount, sorted in…
A: Program approach:- Using the necessary header file. Using the standard namespace I/O. Define the…
Q: QUESTION 2 1) Write a maxConsecutiveDiff function which returns the maximum difference between any…
A: // MaxDifferenceOfConsecutive Numbers #include<iostream>#include<cstdlib> // including c…
Q: Question 14 Write a function named "CompareTwo" that accepts four parameters: : A1: array of type…
A: code: #include <bits/stdc++.h> using namespace std; int compareTwo(int A1[], int S1,int…
Q: Question 19 A Consider the following statement, which is intended to create an ArrayList named years…
A: Answer: A. ArrayList years ArrayList years=new ArrayList(), This statement is old non generic…
Q: Write a function named "location_of_largest" that takes as its arguments the following: (1) an array…
A: The question is to write a function that returns the subscript of the element containing largest of…
Q: write a function called adding an array of numbers as the only parameter. this function should use…
A: start declare list make function adding and pass list as a parameter then using map and lambda…
Q: Your task is to create a function that simulates a vending machine. Given an amount of money (in…
A: function vendingMachine(products, money, number) { let coins = [500,200,100,50,20,10], result =…
Q: Question 2: Write down a function called getPolarity(), which receives a 1D array of size 10 as an…
A: #include <stdio.h>#include <stdlib.h> int *getPolarity(int n[] ){ int *a = malloc(10…
Q: NumPy includes a submodule numpy.linalg where many functions are defined to allow the user to do…
A: Introduction: Numpy is the library used in Python for array and the "linalg" is a submodule under…
Q: Write a function called FindMyChar that receives three parameters: the name of the array the array…
A: "Since you have not mention any programming language, so wee will write this program in C language."…
Q: Create an application that simulates a game of Tic Tac Toe in C# using a two-dimensional array. At…
A: The above program is given below in C# Programming Language.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- In the Programming (Part 1) you will create an array of Leg objects. There's just one constructor, and it takes three parameters -- two city names (like "San Francisco" and "Pleasant Hill") as constant C string, and one number representing the distance in miles between the two cities (whole number or floating point -- your choice). Write a code block to create a static array (that is, not dynamic and not a vector) of 3 Leg objects using city names of your choosing. That's THREE objects, each created using THREE parameters. For example, the Leg class declaration looked like, class Leg { const char* const startCity; const char* const endCity; const double distance; public: Leg(const char* const, const char* const, const double); }; HINT: "constant C strings" as parameters and as constant data members are const char* const constant read-only pointers. Do NOT use char arrays for this (that is, no square brackets). When you write code for an exercise like this, write in…1) Write a function named maxDiff which returns the maximum difference between any two values in a 3x3 2D array.This function should accept a 3x3 2D array, and the size of each dimension as parameters.ExampleCalling maxDiff with this 2D array:33 71 2092 38 6382 54 32Returns a maximum difference of 72 (92 - 20).Write a program that declares/intializes two arrays as described in main() and has two functions. main() - The size of both arrays is 5. The first array has elements of type double. The values are for distance measurements. Choose a descriptive name for this array.The second array will have the unit of measure. Choose a descriptive name for this array. Initialize the first 4 elements using an initialization list with the values "mi", "mi", "km", "km". Assign a new value to the first element of the second array: "km"Assign a value to the last element of the second array: "mi" Use a loop with statement that ask the user to type in all of the values for the temperatures and assign them to the first array. Function calls in main() -- you might want to write the definitions first (or at least read about them) before coming back to main() to write the calls. call the function that prints the measurements along with the unit of measure.Call the function that can count the number of…
- Write 5 JUnit test cases to test a function designed to show the smallest and largest integers in an array. The function name is SmallLargeInt and the return type is int. JUnit test cases include 1. Array is null 2. Array is empty 3. Array has a single value 4. Array has multiple values 5. Array has positive and negative valuesWrite a function called remove_punct() that accepts an array of characters and the number of items in the array as parameters, removes the punctuation (',', '!', '.') characters from the array, and returns the number of punctuation characters removed. For example, if the array contains ['C', 'p', 't', 'S', ',', '1', '2', '1', '.', 'i', 's', 'f', 'u', 'n', '!'], then the function should remove the punctuation characters. The function must remove the characters by shifting all characters to the right of each punctuation character, left by one spot in the array. This will overwrite the punctuation characters, resulting in: ['C', 'p', 't', 'S', '1', '2', '1', 'i', 's', 'f', 'u', 'n']. In this case, the function returns 3. Note: if the array does not contain any punctuation characters, then the array is unchanged and the function returns 0.1) Create a function named "justEmails". The function should accept a parameter for JSON data named "data". The function should loop through the JSON user data with forEach(). Using the push method, add each user email to a new array// Return the new array of emails.// Test your function with this// JSON data:const jsonData = [ { id: 1, name: "Leanne Graham", username: "Bret", email: "Sincere@april.biz" }, { id: 2, name: "Ervin Howell", username: "Antonette", email: "Shanna@melissa.tv" }, { id: 3, name: "Clementine Bauch", username: "Samantha", email: "Nathan@yesenia.net" }]; //////////////////HINT: The Higher Order Functions filter(), map(), and reduce() have inner functions that use a return statement. By putting HOFs inside of a function you create, you will also need to return the result of the HOFs.
- Write a program that creates a two-dimensional array initialized with test data. Use any data type you wish. The program should have the following functions:a. getTotal . This function should accept a two-dimensional array as its argument and return the total of all the values in the array.b. getAverage . This function should accept a two-dimensional array as its argument and return the average of all the values in the array.c. getRowTotal . This function should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the total of the values in the specified row.d. getColumnTotal . This function should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The function should return the total of the values in the specified column.e. getHighestInRow .…For this C++ called getArrayLength that counts up the number of elements in an array of integers that ends with the sentinel value, -999. The only parameter needed is the array. Finish the function below. This function will be used in solution for the next question. #include <iostream>using namespace std; /** int getArrayLength(int srcArray[])* @param: an array of integers that ends in the sentinel value -999* @returns: the length of the array not including the sentinel value.*/int getArrayLength(int srcArray[]){// ToDo: Fill-in the code to count the good values in the array.}int main() {int array[] = { 1, 3, 5, 7, 9, 11, -999 };cout << "The array has " << /* ToDo: call your function */ << " elements in it.\n";return 0;}3) Create a function named "makeThemOdd". The function should accept a parameter named "numberArray". Use the higher order function map() to create a new array that contains all the numbers from the original parameter array but adds 1 to each even number. The new array should only have odd numbers in it. Return the new array. // Use this array to test your function:const testingArray = [1, 2, 4, 17, 19, 20, 21];
- C++ Write a function named “getTotalHourAndPayout” that accepts an array ofPayStub object pointers and its size. It will return the total number of hours andpayout amount for all of the PayStub in the given array. For example, if we have two paystubs of 40 hours and $10 pay rate with 50 hoursand $10 pay rate, it will return 90 hours and $950.Please show you would call and test this function.javascript 7. Create a function that filters out negative numbers In this challenge, you'll have a function that takes an array as an input and returns an array. But if all goes according to plan, it'll remove the negative numbers. This is another example of a task that'll be useful when combing through data and looking for clever ways to eliminate "bad data."Write a function removeDuplicates -PHP( arr) that takes an associative array as a parameter and returns the same associative array except with all duplicate values removed. You may not use the function array_unique for this problem. For example:$arr = array( 'a' => "one", 'b' => "two", 'c' => "three", 'd' => "two", 'e' => "four", 'f' => "five", 'g' => "three", 'h' => "two" ); Expand (10 lines) print_r(removeDuplicates( arr)); Would print: Array ( [a] => one [e] => four [f] => five )