Using JavaScript Define a function getMonth which accepts number from 1 to 12 as an argument and return the descriptive name of the month. For example: getMonth(1) should return January while getMonth(12) returns December, finally getMonth(-1) returns null. Use array or object to define a list of names for the month and refrain from using if statement to check the argument if it's 1, 2, etc.
Q: Write a function that accepts two arguments,, an array of integers, and a numberindicating the…
A: CODE:- #include <iostream>using namespace std;int sumarray(int[], int);int main(){int n=6,i,…
Q: Create a function that takes an array of numbers and returns the second largest number. IN JS…
A: Create a function that takes an array of numbers and returns the second largest number. IN JS…
Q: def fun_a(cards): """ cards is a list of int numbers ranging between 0 to 12 inclusive. We…
A: Actually, function is group of statements.
Q: JAVA Programming Write a function that returns true if you can partition an array into one element…
A: Algorithm - Take one string as input. Now use the below logic if(count==1) return false;…
Q: Implement a single, complete C function named "count_vowels" that counts the number of lowercase…
A: Among the 26 alphabets present in the English language, there are 5 vowels and 21 consonants. "a",…
Q: Create a function that takes an array of numbers and returns the second largest number. IN JS…
A: Here we will first define a function named Second_Largest which returns the second highest number…
Q: Given an integer array of positive single digit values such as: int a[) = {8,4,2,6,9}; 1) Write a…
A: The objective of the given problem is to create a recursive function that concatenates all array…
Q: Create a function that takes two numbers as arguments (number, length) and then returns the list of…
A: The objective is to create a function that takes two numbers as arguments as (number, length) it…
Q: JAVA Programming Write a function that returns true if you can partition an array into one element…
A: In this problem we need to design the JAVA program. Input - Array Ouput - Boolean Logic -…
Q: Take a sorted array of 15 elements of type int and a value x from user, you need to find the ceiling…
A: Given:- Take a sorted array of 15 elements of type int and a value x from user, you need to find the…
Q: Create a function that takes the dimensions of two triangles (as an array) and checks if the first…
A: 1. Create the New method with 2 arguments.2. check the Brick array elements sum.3. iterate on the…
Q: In C Write a function that gets an array of points (see definition in assignment3.) and sorts the…
A: Basic qsort function is defined in stdlib header file. We have to pass the array the length of…
Q: Write a function that will combine two arrays of different lengths into another array. Express the…
A: In this program, we have to write a program for merging two array into a one array. so, for this…
Q: Given an array of integers, define a function that takes the array as a parameter and return true if…
A: In this Array of integer, We have to check if the array of length is 1 or more than 1 Then we have…
Q: Create a function which constructs a rectangular birthday cake, based on someone's name and age !…
A: def getBirthdayCake(name,age): message = " Happy Birthday " i = 0 if(int(age)%2==0):…
Q: Complete the following function definition to recursively print the index of a unique value in an…
A: we have to write all code in the blanks
Q: To accelerate the processing, we would like to split the original list of messages into 3. Rewrite…
A: CODE:- // Go program to illustrate how// to create an anonymous Goroutinepackage main import (…
Q: We have an array (x) of ints: x = {6,2,3,1,6,1,1,7,8} We would like to write a void function, call…
A: #include<iostream>using namespace std; void newArray(int *arr){ int a=0; int b=0; int…
Q: Create a function that takes an array of numbers and returns the second largest number. IN JS…
A: Algorithm - In this problem, we will create a method SecondLargest. Use the below logic Now…
Q: Implement the following function without using any additional data structure, and without sorting…
A: ANSWER:-
Q: Write a function named fill_array, which takes an array and its size as parameters, and writes the…
A: Use a loop to calculate sum Then use another loop to fill this sum in all values of array
Q: Write a function that gets an array as a parameter, sorts it in an ascending fashion and returns the…
A: Function Plan: write the function int sortASC(int* myArray, int size) this function takes argument…
Q: A set of integers may be implemented using an array of integers. Since the array is only partially…
A: set.h Code: #include<stdio.h> typedef int Set[100]; //Function dclarations void…
Q: 2. Implement a function called findMinGap that will return the smallest gap betweenadjacent entries…
A: The C++ program and approach are given below:Approach:Declaring the essential headers and the…
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 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 that takes 3 arguments, all integers. // It returns an array starting with the…
A: Here I have defined the function countWithIntervals(). Inside the function, I used a loop to…
Q: A set of integers may be implemented using an array of integers. Since the array is only partially…
A: Note: As you have asked the multipart question, as per our policy we will solve the first three…
Q: Create a function that accepts a two dimensional array of integers and displays a) Row by row ( fix…
A: A required program is as follows, #include<stdio.h> #define r 3 #define c 4 /*Define a…
Q: Create a function that takes the dimensions of two triangles (as an array) and checks if the first…
A: ANSWER:-
Q: Create a function that takes the dimensions of two triangles (as arrays) and checks if the first…
A: Algorithm - Take Input from user. Now use the below logic - if(brick[0]+brick[1] <…
Q: to pass an integer array of 10 elements to a function which returns the same array after sorting it…
A: the code : #include <stdio.h> // Sorting function - Bubble sortvoid Sort(int arr[], int n){…
Q: C language) Write a function intersect() that takes five arguments: an array of integers, number of…
A: Program Plan:- Ask the user to enter the size of the two arrays along with their elements. Declare…
Q: 3) A function is implemented with a feature to print a line when x is found in the array A. def…
A: Your output of python program for all three function is given below with an output screenshot .
Q: Create a function that takes the dimensions of two triangles (as arrays) and checks if the first…
A: Algorithm - Take Input from user. Now use the below logic - if(brick[0]+brick[1] <…
Q: Write a function named countUnique that returns the number of unique values in a sorted array. Since…
A: Program plan: Iterate over the array elements to get the length. Define the first element as the…
Q: function biggest_gap(L) that takes a list L of real numbers
A: Approach As language is not mentioned, the function is written in javascript since two values are…
Q: Write a program to declare an integer array of 50 elements. Write a function getArray() to get…
A: Step 1:- Program Approach:- 1.Create the getArray() function to accept the input from the user and…
Q: A set of integers may be implemented using an array of integers. Since the array is only partially…
A: Note: Comments are mentioned in the code for understandability instead of specifying the procedure…
Q: Create a function that takes the dimensions of two triangles (as arrays) and checks if the first…
A: In this problem, we will design the code in the javascript. Algorithm - First, we will create a…
Q: Given an array of integers of size 10. Write a C++ function that takes the array as a parameter and…
A: requirements: find the small means total number between 1 to 10 in the given array 1. Enter 10…
Q: Write a C function countEven() that takes an integer array and the number of elements in the array…
A: The function countEven() will be defined as follows: The parameters are an array and the size of…
Q: Using Javascript Write a higher-order function that when given an array of numbers, return a new…
A: Program Approach: Include open script tag. Define function even only and pass array. Now use filter…
Q: Write a findSpelling Function -PHP Write a function findSpellings($word, $allWords) that takes a…
A: The soundex() function is a built-in function in PHP and is used to calculate the Soundex key of a…
Q: Create a function that takes an array of numbers and returns the second largest number. IN JS…
A: In this problem, we need to design the JS code to solve the problem Input - one array Output -…
Q: Write a function that verifies if a given number exists in an array of floats. The function is…
A: Given the function is supposed to return the first position in where the number is encountered. If…
Q: JAVA Programming Write a function that returns true if you can partition an array into one element…
A: Algorithm - Take one string as input. Now use the below logic if(count==1) return false;…
Q: Write a recursive function int count_digit(string s) to count the number of digits in a string s.…
A: Here, I have to write a C++ program for the above question.
Q: Write in Java. Given an array A, push all the zeros of the array to the front. The order of all…
A: Actually, array is a collection of elements.
Q: Write a program that dynamically allocates an array large enough to hold a user defined number of…
A: Explanation: The first step is to include the header file. The next step is to create a pointer…
Using JavaScript
Define a function getMonth which accepts number from 1 to 12 as an argument and return the descriptive name of the month. For example: getMonth(1) should return January while getMonth(12) returns December, finally getMonth(-1) returns null. Use array or object to define a list of names for the month and refrain from using if statement to check the argument if it's 1, 2, etc.
Step by step
Solved in 2 steps with 2 images
- Unfair hurdles are hurdles which are either too high, or way too close together. Create a function which takes in an array of strings, representing hurdles, and returns whether or not they are unfair. For the purposes of this challenge, unfair hurdles are: • At least 4 characters tall. • Strictly less than 4 spaces apart. Examples // Hurdle are good distance apart but are way too tall. isUnfairHurdle ([ "# "# "# ]) → true ## // Hurdles are a fine height but are way too close together. isUnfairHurdle ([ "# # # #", "# # # #" "# # ]) → true "# "# ]) → false #" // These hurdles are mighty splendid. isUnfairHurdle([ #Unfair hurdles are hurdles which are either too high, or way too close together. Create a function which takes in an array of strings, representing hurdles, and returns whether or not they are unfair. For the purposes of this challenge, unfair hurdles are: • At least 4 characters tall. • Strictly less than 4 spaces apart. Examples // Hurdle are good distance apart but are way too tall. isUnfairHurdle([ "# "# "# "# ]) → true #"mergeAndRemove(int[], int[]) This is a public static function that takes a int[] and int[] for the parameters and returns an int[]. Given two arrays of integers. Your job is to combine them into a single array and remove any duplicates, finally return the merged array.
- In C++ language For number 2 through 4 create an integer array with 100 randomly generated values between 0 and 99; pass this array into all subsequent functions. Place code in your main to call all the methods and demonstrate they work correctly. Using just the at, length, and substr string methods and the + (concatenate) operator, write a function that accepts a string s, a start position p, and a length l, and returns a subset of s with the characters starting at position p for a length of l removed. Don’t forget that strings start at position 0. Thus (“abcdefghijk”, 2, 4) returns “abghijk” Create a function that accepts the integer array described above returns the standard deviation of the values in a. The standard deviation is a statistical measure of the average distance each value in an array is from the mean. To calculate the standard deviation, you first call a second mean function that you need to write (do not use a built in gadget. Then sum the square of the difference…Create a program that accepts an integer N, and pass it to the function generatePattern. generatePattern() function which has the following description: Return type - void Parameter - integer n This function prints a right triangular pattern of letter 'T' based on the value of n. The top of the triangle starts with 1 and increments by one down on the next line until the integer n. For each row of in printing the right triangle, print "T" for n times. In the main function, call the generatePattern() function. Input 1. One line containing an integer Output Enter N: 4 T TT TTT TTTTImplement this program to understand use of Arrays in real world examples. A small airline has just purchased a computer for its new automated reservations system. You have been asked to develop the new system. You are to write an application to assign seats on each flight of the airline’s only plane (capacity: 10 seats). Your application should display the following alternatives: Please type 1 for First Class and Please type 2 for Economy. If the user types 1, your application should assign a seat in the first-class section (seats 1–5). If the user types 2, your application should assign a seat in the economy section (seats 6–10). Your application should then display a boarding pass indicating the person’s seat number and whether it is in the first-class or economy section of the plane. Use a one-dimensional array of primitive type boolean to represent the seating chart of the plane. Initialize all the elements of the array to false to indicate that all the…
- Write a public static void function named getLongestName. This function should be designed to take a String [] reference variable and use this to find the longest name in the array. Your function should then return this String.Make a call to this function in your main function passing it namesList at the actual parameter. Use the returned string so that you print out a meaningful message to the screen.Write a function called initializeArray that receives an array, its size, and two integers andinitializes the array with random values between the first integer and the second integer. Write anotherfunction called printArray that receives an array and its size and prints the array elements in a column. Writea test program that declares and initializes an array of size 20 with random values between 0 and 10 inclusive,and then prints the array using the above functionsfrom surround import surround inputs = [] [] answers = L = ["tank", "godzilla", "tank"] ["tank"] inputs.append (L) answers.append(a) a = TESTS len(inputs) passed = 0 for i in range(TESTS): try: result = surround (inputs[i]) if result not in answers[i]: print("Error found for input: " + str(inputs[i])) else: passed += 1 except Exception: pass result = "Tests passed: + str(passed) + "/" + str(TESTS) print(result)
- Write in C++ Alice is trying to monitor how much time she spends studying per week. She going through her logs, and wants to figure out which week she studied the least, her total time spent studying, and her average time spent studying per week. To help Alice work towards this goal, write three functions: min(), total(), and average(). All three functions take two parameters: an array of doubles and the number of elements in the array. Then, they make the following computations: min() - returns the minimum value in the array sum() - returns the sum of all the values in the array average() - returns the average of all the values in the array You may assume that the array will be non-empty. Function specifications: Function 1: Finding the minimum hours studied Name: min() Parameters (Your function should accept these parameters IN THIS ORDER): arr double: The input array containing Alice's study hours per week arr_size int: The number of elements stored in the array Return Value:…Scrabble Scrabble is a game where players get points by spelling words. Words are scored by adding together the point values of each individual letter. Define a function scrabble_score (word:str) -> int that takes a string word as input and returns the equivalent scrabble score for that word. score = {"a": 1, "c": 3, "f": 4, "i": 1, "1": 1, "o": 1, "r": 1, "u": 1, "t": 1, "x": 8, "z": 10} For example, "b": 3, "h": 4, "n": 1, Your Answer: == 20 assert scrabble_score("quick") assert scrabble_score("code") == 7 1 # Put your answer here 2 Submit "e": 1, "d": 2, "g": 2, "k": 5, "j": 8, "m": 3, "q": 10, "p": 3, "s": 1, "w": 4, "v": 4, "y": 4,The international standard letter/number mapping for telephones is: Write a function that returns a number, given an uppercase letter, as follows:def getNumber(uppercaseLetter):Write a test program that prompts the user to enter a phone number as a string. The input number may contain letters. The program translates a letter (uppercase or lowercase) to a digit and leaves all other characters intact. Here is a sample run of the program: Enter a string: 1-800 flowers1-800-3569377