Define a void function printContactInfo with one string parameter. The function will transform a string of the following format: phone number, last name, first name (one string with 3 parts separated by commas) For any string entered as argument, the function will print out the last name, followed by the first name, followed by the phone number, each word separated by a blank space, in one line. How to solve this problem: Use the string method find(...) to find the indices of the commas and then apply string slicing. The phone number is the substring before the first comma. the last name is the substring between the first comma and the second comma. the first name is the substring after the second comma.
Q: Write a program in JavaScript and make a function and a second function which check the pass…
A: Requirements:- Write a program in JavaScript and make a function and a second function that check…
Q: Define a function CalcPyramidVolume with double data type parameters baseLength, baseWidth, and…
A: The volume of a pyramid is the space that a pyramid occupies.
Q: Write a definition for a void-function that has two int value parameters and outputs to the screen…
A: Solution: Given: Two int value parameters and outputs to screen the product of these arguments.…
Q: Computer Science For each of the obfuscated functions below, state what it does and, in no more…
A: Both the codes are written in VS code. Their functions are illustrated in the subsequent steps.
Q: Write a function pythagorean that takes three integers $a$, $b$, $c$, and returns the boolean whose…
A: I have given an answer in step 2.
Q: Q1: Complete the following program by writing its functions: static void Main(....) { } 10, 12, 7,…
A: Power(a[1], a[2], ref p); This function is wrong as a is an integer and not an array. So we cannot…
Q: (a). Write a class Volume in C++ program to find volume of cube, cylinder and rectangular box using…
A: (a). Write a class Volume in C++ program to find volume of cube, cylinder and rectangular box using…
Q: void recurse(int num) { if (num == 0) cout << “ Zero” << endl; else { cout << " " <<…
A: NOTE: - The call being made to recurse(num +1) in else statement is missing the semi-colon. if…
Q: Write a program in Python with a function perfectcube(n), which returns True if n is a perfect cube…
A: code:-
Q: Write a C program that includes the definitions of the following functions: a) is_lower(..) : is it…
A: #include <stdlib.h>#include <stdio.h>#include <ctype.h>#include <math.h>…
Q: Create a function that transforms sentences ending with multiple question marks? or exclamation…
A: As the programming language is not mentioned here, we are using JAVA The JAVA code and output are…
Q: Implement the following in a C project structure: - A function called Grader that takes a…
A: Answer : I have Given C code, code Screenshots, and the output in Step 2:
Q: John is used to doing programming in Python and since the print() function in Python by default…
A: Write a function myecho() in PHP language that takes a string as the parameter and prints the string…
Q: Write a program in C++that contains overloaded functions with name OvOperation(). When the main…
A: 1.Define a function named ovOperation with return type int 2.In the function definition compare two…
Q: Design a class ProblemSolution to overload a function solution. Write a function int…
A: import java.util.*; public class ProblemSolution{ static int solution(int N, char CH) { //…
Q: Create a function that transforms sentences ending with multiple question marks? or exclamation…
A: In this problem, we need to provide the solution in the PHP programming language. Input - String.…
Q: Given an alphabet, print all the alphabets up to and including the given alphabet. Write a…
A: I have added the output screenshots for better understanding. Example one shows the output when we…
Q: Write the definition of a void function with three reference parameters of type int, double, and…
A: Function definition: The function definition gives the genuine code that is executed by the…
Q: Create a function that transforms sentences ending with multiple question marks? or exclamation…
A: Since the programming language is not mentioned, I have done the code using JavaScript.
Q: Write a function that counts and returns the number of vowels in a word. The function's one…
A: Given data is shown below: Write a function that counts and returns the number of vowels in a word.…
Q: Define a function ComputeGasVolume that returns the volume of a gas given parameters pressure,…
A: Inside main function, read pressure, temperature and number of moles as a user input. Call…
Q: Given two vectors of integers (either positive, negative or zeros) v, and v, of length d, and d2…
A: Given: We have give the schema of the program and our task is to run the program by providing the…
Q: Write a python function that takes a list as a parameter. The list consists of scores of 3 sections…
A: Returning the multiple values from the python function: The function that returns multiple values…
Q: Write a c++ program that takes a date in the following format: December 24th, 2021 and extracts the…
A: The program is written in c++. Here, December 24th, 2021 and extracts the day, month, and year as 3…
Q: Write the definition of a bool function named BooleanMode () whose header is bool BooleanMode (bool…
A:
Q: Please write a full code in JAVA for this: A function foo has k integers as input arguments,…
A: #include #include #include #include 57 /* concatenate n copies of src into dest */ /* returns dest…
Q: Write a function called translate_to_italian () that takes a string as a parameter (a colour).…
A: #you didn't specified the language. So i wrote in Python language. def translate_to_italian(colour):…
Q: sumDigits, then, finds the smallest integer between f and t (both inclusive) whose sum of digits is…
A: function sumDigits(f,t,x): Start for f to t follow steps 3 to 8 n=i sum=0 while n>0 follow steps…
Q: Implement a function eligible in Python that returns a list of the names of people that are eligible…
A: Required: Implement a function eligible in Python that returns a list of the names of people that…
Q: Create a function that transforms sentences ending with multiple question marks? or exclamation…
A: 1. Created the new method and pass the string arguments2. Add the replace logic.3. return the String
Q: Write in Java. Given an alphabet, print all the alphabets up to and including the given alphabet.…
A: import java.util.*;public class Main{ static void printAlphabet(char ch) {…
Q: Consider the code in the clear_one function. void clear_one (int m[N] [N][N]) int i, j, k; for (i =…
A: clear_one function takes argument a three dimensional matrix m of size nXnXn
Q: With function: void swapNum(int n1, int n2) { int temp = n%; %3D n1 = n2; n2 = temp; %3D And with…
A: Swapping two number in C programming language means exchanging the values of two variables.
Q: Write a simple JavaScript program to calculate the average mark and to calculate the grade of a…
A: We need to write a JavaScript language program to find the Average marks of the student and the…
Q: Write a function swap to swap two int values. For instance, we have two variables int a, b and…
A: C++ code: #include<iostream> using namespace std; void swap(int *a, int *b){ int *c;…
Q: Write the definition of a function named isSorted that receives three arguments: an array of int, an…
A: While doing programming in any programming language, you need to use various variables to store…
Q: Write a function called translate_to_italian () that takes a string as a parameter (a colour).…
A: We chose C++ to execute this logic but this can be applied in any programming language.
Q: Write a C++ function, lastLargestIndex, that takes as parameters an int array and its size and…
A: Given: Write a C++ function, lastLargestIndex, that takes as parameters an int array and its size…
Q: Create a function that transforms sentences ending with multiple question marks? or exclamation…
A: Since the programming language is not mentioned I have done the code using JavaScript.
Q: Write a function swap to swap two int values. For instance, we have two variables int a, b and a=10,…
A: C++ code: #include<iostream> using namespace std; void swap(int *a, int *b){ int *c;…
Q: Create a function that takes an amount of monetary change (e.g. 47 cents) and breaks down the most…
A: 1. Create the method with a number argument. 2. Create the variable q and Divide it by 25. 3. Create…
Q: Write a function whose prototype is void exchange(int *p, int *q);that takes two pointers to integer…
A: Write a function whose prototype is
Q: Reads two integers from the keyboard and stores them in input1 and input2 respectively. ➔ void…
A: Pass-by-reference means to pass the reference of an argument in the calling function to the…
Q: Trace the function f as demonstrated in class for the function call f(3, 2): void f(int x, int y) {…
A: Here in this question we have given a c++ code segment and we have asked to trace the following code…
Q: Write a function called number_matrix(r,c) that takes two parameters r and c and PRINTS ON THE…
A: #include <stdio.h> void number_matrix(int r, int c){ int i = 1; int j = 1; int k = 1;…
Q: Consider the code in the clear_one function. void clear_one (int m[N] [N] [N]} { int i, j, k; for (i…
A: Solution : The given function
Please use python. thanks
Step by step
Solved in 4 steps with 2 images
- Write a c++ program that takes a date in the following format: December 24th, 2021 and extracts the day, month, and year as 3 integers. Your program should have the following functions: (a) WriteafunctiongetDatethatpromptsausertoenteradateasastringandreturns it. (b) Write a function extract that takes as its parameter a date and returns the day, month, and year as 3 integers.use the function isdigit(c) that returns true if c is a digit character and false if otherwise. (c) Write a function convertDigits that takes as its parameter a string of digits and converts it to an int.(to convert a digit character to a digit number use static_cast<Int> ('D') - static_cast<Int>('0') where d is 0,1,...,9) (d) Write a function convertMonths that takes as its parameter a month as a string and returns a corresponding number from 1 to 12 (1 for January, . . . , 12 for Decem- ber).Define a function CalcPyramidVolume with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volume of a pyramid with a rectangular base. Relevant geometry equations:Volume = base area x height x 1/3Base area = base length x base width.(Watch out for integer division). #include <iostream>using namespace std; /* Your solution goes here */ int main() { double userLength; double userWidth; double userHeight; cin >> userLength; cin >> userWidth; cin >> userHeight; cout << "Volume: " << CalcPyramidVolume(userLength, userWidth, userHeight) << endl; return 0;}Please answer it in Python Write a function double_consonnant that takes as an argument a word and has two return values: a Boolean worth True if the word contains a double consonant (twice the same consonant in a row), and in this case the second return value is the consonant that is doubled; if there is no doubled consonant, the function must return False and None. If the word contains several double consonants (for example, 'successor'), true will be returned and the first double consonant appearing in the word. Examples: double_consonne('arrivee') is true, 'r'. double_consonne (‘bonbon’) is false, None double_consonne('appelle') is True, 'p'
- Write a c++ program that takes a date in the following format: December 24th, 2021 and extracts the day, month, and year as 3 integers. Your program should have the following functions: (a) WriteafunctiongetDatethatpromptsausertoenteradateasastringandreturns it. (b) Write a function extract that takes as its parameter a date and returns the day, month, and year as 3 integers. (c) Write a function convertDigits that takes as its parameter a string of digits and converts it to an int. (d) Write a function convertMonths that takes as its parameter a month as a string and returns a corresponding number from 1 to 12 (1 for January, . . . , 12 for Decem- ber).Write a function that converts a phrase into pig Latin. A word is convertedto pig Latin by removing the first character of the word, placing it at theback of the word, and adding the characters “ay” to the word. For example,“hello world” in pig Latin is “ellohay orldway.” Your function can assumethat each word consists of at least two letters and that each word is separatedby one space, with no punctuation marks.Write a definition for a void-function that has two int value parameters and outputs to the screen the product of these arguments. Write a main function that asks the user for these two numbers, reads them in, calls your function, then terminates. c++
- solve the problem in java:Consider the are n=2 subjects and needed =[4,5]answered questions, to pass.The student has answered =[2,4] questions in the two subjects so far, and can answer another q=1 questions across all subjects combined. The best outcome is to answer an additional question in the second subject on order to pass it, as 2 more answers required to pass the first subject. the max number of subject s that can be passed is 1. the function must return an integer that can represent the max number of subjects that can be passed. public static int maxNumsub(List <Integer> answered, List<Integer> needed, int q){//write code here}Please answer it in Python Write a double_consonant function , It takes a word as a parameter and has two return values : A Boolean value equals True If the word contains a double consonant ( The same consonant twice in a row ), under these circumstances , The second value returned is the double consonant ; If there are no double consonants , Function should return False and None. relevant information : To simplify the exercise , We don't use words that contain multiple double consonants ( for example ,“successor”) Test your functionality on . Example : double_consonne('arrivee') vaut True, 'r'.double_consonne('bonbon') vaut False, Nonedouble_consonne('reussite') vaut True, 's'Write program in python with a function occupy(n), which shows how birds are going to occupy n nests, assuming that each new bird will choose the nest in the middle of the largest unoccupied run of nests. For example, if there were 10 nests, occupy(10) would print out the following sequence, where underscore indicates an unoccupied nest, and X indicates an occupied nest. The first line of the printout is just 10 underscores showing that all the nests are unoccupied. The second line shows that a bird came to nest in position 5, since that is one the first middle positions of the unoccupied run from 0 to 9. In the third line a bird came to occupy the middle position for the longest open run of nests, from 0 to index 4.
- 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 TTTTWrite a function (define) the_divisor(n, bound), that takes in two int values. N is the number you search for a divisor and bound will also be an integer. The function the_divisor should return the smallest divisor which is greater than bound. If no such integers exists, return -1. You cannot assume that the first argument will be larger than the second. In python >>› the_divisor (25,3) 5 >>>the_divisor (5,25) -1 >>>the_divisor(25,5) 25Design a class ProblemSolution to overload a function solution. Write a function int solution(int N, char CH) that accepts integer N and character CH. The function should return square of a number (N) if a character (CH) is "s" otherwise return cube of a number. int solution(int N, int M, char CH) that accepts two integers (N and M) and one character CH. The function should return the product of two integers if a character (CH) is ‘p’ otherwise return their sum. boolean solution(String S1, String S2) that accepts two strings S1 and S2. The function should return true if S1 and S2 are equal otherwise false. Input 1 4 s where, First line represents a choice for calling one of the defined methods. (1 for solution(int N, char CH), 2 for solution(int N, int M, char CH) and 3 for solution(String S1, String S2)). Second line represents number input. Third line represents choice CH. Output 16 Here, the first line contains 1 and hence solution(int N, char…