1- printlnfo: This function prints your name and ID to the screen. 2- caleShapeArea: This function calculates and returns the area of a shape (Triangle or Rectangle). The function should take two double arguments (dimensions of the shape) and a single character (T, or 'R'). * If the character argument is T then the area of a triangle with the passed arguments should be calculated and returned. • If the character argument is R' then the area of a rectangle with the passed arguments should be calculated and returned. + Otherwise the function should return 0. 3- caleSeriesLog: This function calculates and returns the value of log,«(1²+2*+. +N°). The function should take one integer argument (N). Hint: Use loops to calculate the series and the cmath library to calculate its log.
Q: Programming Assignment 6: SwapPoints Objective: To write two missing functions that manipulate…
A: Code with Output given below:
Q: When the following main function runs, what will display on the screen? int main() {int number;…
A: Output: The value is number
Q: ● Prompt a user to input numerical values. If a wrong value is given, prompt the user again until a…
A: Answer : code is given at bottom 1.Taking user input through input box. when check button is pressed…
Q: write the psuedocode and drow the flowchart Create a program to enter grades and calculate averages…
A: In this question it asked to give the pseudocode and draw a flowchart. The question needs to create…
Q: Rules of Movement Our robot can only move in one of the following directions: right(r), left(1),…
A: We use java.awt.Robot class to capture pixels of screen. It provides method like createScreenCapture…
Q: The main function creates 5 pixels with random red, green, and blue values. Complete the id_color…
A: So you create a pixel inside the main function five times (using for loop) and you call the…
Q: Question 1 Create a VB.NET Console Application that does the following: Create a variable of Integer…
A: Module VBModule Sub Main() Dim marks as integer' to declare marks as integer Dim grade as…
Q: , c) write a piece of code in C# that calculates the area of a triangle displaying the area in the…
A:
Q: Dart game: Dart location Write a function called DartNumbers() that takes the location of darts…
A: In given radius of area C is 1,B is 2 and A is 3. Then total area of circular region with radius 3…
Q: code up the addAppointment() function. This function runs when the user clicks on the 'MAKE…
A: In this question we have to write a HTML and JavaScript program where we have implement…
Q: A vertical tab escape sequence. \n O lb If char is a letter of the alphabet, this function returns…
A: Vertical Tab Escape Sequence: An escape sequence is a series of characters that, when used inside a…
Q: Please Write a function to validate please make the code in java like this function validate()…
A: The program is written in HTML and Javascript. Please find the source code and output in the…
Q: separate .py def triangle(base, height): area=0.5*base*height print("Triangle Area: ", area) def…
A: The above question is solved in step 2 :-
Q: Fix the code in the code tab to pass this challenge (only syntax errors). Look at the examples below…
A: function sumArray(arr) { let sum = 0; for (let i = 0; i < arr.length; i++) { sum+= arr[i] }…
Q: Q5: Complete the function that calculates the position of an object at any time t> 0. The initial…
A: code def calculate_position(s0,u0,a,t): position = u0*t + 0.5*a*t*t position=position+s0…
Q: B. Maximum of Two Values Design a function named max that accepts two integer values as arguments…
A: 1) read two numbers 2)call function max and print the return value In max function using if-else…
Q: SwapPoints Objective: To write two missing functions that manipulate objects, to complete a given…
A: Solution Code: import java.util.Scanner;class test{ private int x,y; public void…
Q: 5. The equation for the area of a circle is A = tr². Create a user-defined function that calculates…
A: Given: Area =pi*r*r pi=22/7 and r is the radius. input argument is the radius r user defined…
Q: Add this comment: # Ass 1: Part 3 Define two functions: The first one is called: YourIntAsString…
A: Code import java.util.*;public class Main{ String YourIntAsString(int x){ String arr[] =…
Q: Design a pseduocode function named getFirstName that asks the user to enter his or her first name…
A: I have given an answer in step 2.
Q: Starting Out With Visual Basic 8th edition chapter 6 #1 made in visual studio 2017 Retail…
A: i have divided the steps for better understanding :- Program Plan: • Implement an application that…
Q: palindrome.py -> using sys.argv ● Create a program, palindrome.py, that has a function that takes…
A: Given: Create a program, palindrome.py, that has a function that takes one string argument and…
Q: 1. The main function creates 5 pixels with random red, green, and blue values. Complete the id_color…
A: For the above program, An Image with a single-pixel was created and passed as an argument to the…
Q: nclude #include using namespace std; #include "h25.h" // Add your code here PLEASE WRITE THE
A:
Q: Function Name: compliments Parameters: answer1 - a boolean (True or False) representing whether the…
A: Solution:The following function displays the outputs as string of compliments.
Q: #include #include #include double area (double r); // this starts the definition for the area…
A: #include <iostream> #include <math.h> #include <cstdlib> double area (double r);…
Q: 12- Strings in a text box can be converted to data by using the function, 13- A translator program…
A: Please find the answer below :
Q: The following function has errors. Locate as many errors as you can. void getValue(int value&) {…
A: GIVEN: The following function has errors. Locate as many errors as you can. void getValue(int…
Q: In the following figure, there is one (combobox), one (textbox), one (button) and one (label). There…
A: FORM DESIGN:
Q: 1. Function The Fibonacci sequence is a series of numbers where a number is the addition of the last…
A: class Main { static int calculateSum(int n) { if (n <= 0) return 0;…
Q: 26- What is a constant that contains a single character enclosed within single quotes? * Character •…
A: 26)- The objective is to state what constant that contains a single character encodes within single…
Q: Create a function Write that gets the value from the input textbox and displays the text in the div…
A: Create a function Write that gets the value from the input textbox and displays the text in the div…
Q: function phone (inputtext) { var phonenum = /^\d{8}$/; if(inputtext.value.match(phonenum)) { return…
A: The answer is b.8 Given code var phonenum = /^\d{8}$/ indicates phone number should contain 8…
Q: Create a string variable containing your full name (with spaces) 2) print the string as shown below…
A: Program: #include<string>#include <iostream> using namespace std; //Function to print…
Q: mplete the process_name() function that takes a single string parameter name. You can assume that…
A: 1- This assignment requires, to take the input as firstName and surname from the user. 2- One space…
Q: Create a program that will take any number in either decimal, binary or hexadecimal and convert it…
A: Programming language : Python Indentation is important in python programming.
Q: This is a program in C language. Help me debug this program. it has 3 errors. Please upload a…
A: Given program is a C++ program, not C program. Because iosteam, cout, cin all these are used in C++.…
Q: This is a set of Alphanumeric characters and Punctuation characters. Control Characters Printable…
A: 1.Alphanumeric characters and punctuation characters Answer: all of the mentioned To find…
Q: Rectangle Area The area of a rectangle is calculated according to the following formula: Width X…
A: Program Code: #include<stdio.h>int area(int w,int l){ int area; area=w*l; return;}main(){ int…
Q: the quotient after q is divided by divisor and assign the result to q. Write this statement in two…
A: Method 1: Simple assignment operator q = q % divisor; Method 2: Modulus AND assignment operator q %=…
Q: Ask the user for an input (an image file). If the file uploaded is not a jpeg/jpg file, print out…
A: Answer: I have done code in python and as well as attached code screenshot.
Q: 1. Retail Price Calculator Write an application that accepts from the user the wholesale cost of an…
A: The code and the output are given below:
Q: A) Freate application Ollect all the following marks and then calculate your final marks based on…
A: According to the information given;- we have to write c# code on the basis of instruction mention.
Q: Flowchart, create. #include #include using namespace std; // Write performOperation() function…
A: Flowchart is in step 2.
Q: Test Average and Grade ite a program that asks the user to enter five test scores. The program…
A: Java code along with the snapshot of code and output is given below:
Q: Help me do a program using Java functions
A: Answer:-
Q: The code below produces a 5 x 10 box of question marks. Convert the code into a function called…
A: In your code, in function header to make drawChar as a default argument, with default value 'X', you…
Q: FizzBuzz Interview Question Create a function that takes a number as an argument and returns "Fizz",…
A: Note: Programming language is not mentioned so doing in python. In the question, we are asked to…
Q: int StrCmp(const char* s1, const char *s2 /*Compares the string s1 with the string The function…
A: The answer is
Step by step
Solved in 3 steps with 1 images
- C++ programming Chapter(s) Covered: Chapter 1-8 Concepts tested by the program: Working with one dimensional parallel arrays Use of functions Use of loops and conditional statements Project Description The Lo Shu Magic Square is a grid with 3 rows and 3 columnsshown below. The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 – 9 exactly. Each number 1 – 9must not be used more than once. So, if you were to add up thenumbers used, The sum of each row, each column and each diagonal all add upto the same number, Write a program that simulates a magic square using 3 onedimensional parallel arrays of integer type. Each one the arrays corresponds to a row of the magicsquare. The program asks the user to enter the values of the magicsquare row by row and informs the user if the grid is a magicsquare or not. See the sample outputs for more clarification. Project Specifications Input for this project: Values of the grid (row by row) Output for this…Cyclops numbersdef is_cyclops(n):A nonnegative integer is said to be a cyclops number if it consists of an odd number of digits so that the middle (more poetically, the “eye”) digit is a zero, and all other digits of that number are nonzero. This function should determine whether its parameter integer n is a cyclops number, and return either True or False accordingly n Expected result 0 True 101 True 98053 True 777888999 False 1056 False 675409820 FalseTracking laps Learning Objectives In this lab, you will practice writing functions, passing arguments and returning results from the function printing the result of a function call writing your code as a module Instructions Main Idea An Olympic-size swimming pool is used in the Olympic Games, where the racecourse is 50 meters (164.0 ft) in length. "In swimming, a lap is the same as a length. By definition, a lap means a complete trip around a race track, in swimming, the pool is the race track. Therefore if you swim from one end to the other, you’ve completed the track and thus you’ve completed one lap or one length." (Source: What Is A Lap In Swimming? Lap Vs Length) Write the function meters_to_laps() that takes a number of meters as an argument and returns the real number of laps. Complete the program to output the number of laps with two digits after the period. Examples Input: 150 Output : 3.00 Input: 80 Output: 1.60 Your program must define and call the following…
- Assignment Name JavaScript Concepts III Assignment Filename lastname-circleArea.html (replace lastname with your last name). area.js Assignment Description This assignment demonstrates the following concepts: JavaScript Functions Assignment Instructions Write a JavaScript program that calculates the area of a circle: Write a function that calculates the area of a circle given the radius. Formula: Math.PI * (radius * radius) Your program code should contain appropriately named variables. Use documentation to identify various components of your program. Call the function once and pass a radius value of 10.75 to it. Use the starter files and complete the logic to satisfy the instructions. To access the files, download and save the circleArea.zip folder attached to this assignment. Then unzip the compressed folder to reveal the included files: circleArea.html and area.js. Be sure that the two files are in the same folder. Then write your code in the area.js…Lab Activity 8: Functions Objectives: The objective of this Lab Assignment is to use functions. As you have learned already, the best approach to solve a problem is to break it down into individual steps. Do not forget about what you have previously learned and seen. This assignment will be asking you to use the knowledge you have acquired since the beginning of the semester. PART 1: Percentage of amino acid residues. Write a function that takes two arguments-a protein sequence and an amino acid residue code - and returns the percentage of the protein that the amino acid makes up. Test your function on the following examples: Sequence MSRSLLLRFLLFLLLLPPLP MSRSLLLRFLLFLLLLPPLP maralllrfllfllllpplp MSRSLLLRFLLFLLLLPPLP Amino acid residue M R L Ynumpy.ipynb 1. addToArray(i) def addToArray(i): # TO DO %time addToArr(10) 2. a function def findDriver(distanceArr, driversArr, customerArr): result = '' ### put your code here return result print(findDriver(locations, drivers, cust)) # this should return Clara 3. The Amazing 5D Music example array([[ 1, 3, -2, -4, -1], [ 0, -1, 1, -1, -2], [ 2, 3, -2, -3, -1], [ 1, -1, 0, -1, -3], [-2, -1, 1, -1, -3], [ 1, 3, -1, -2, -3]]) ``` # TODO array([11, 5, 11, 6, 8, 10]) # TODO array([1, 3, 4, 5, 0, 2]) # TODO # TODO def findClosest(customers, customerNames, x): # TO DO return '' print(findClosest(customers, customerNames, mikaela)) # Should print Ben print(findClosest(customers, customerNames, brandon)) # Should print Ann 4. Numpy drones arr = np.array([-1, 2, -3, 4]) arr2 = np.square(arr) arr2 locations = np.array([[4, 5], [6, 6], [3, 1], [9,5]]) drones = np.array(["wing_1a", "wing_2a",…
- Rest of code in image / This is a bad programming style since it is using goto. // This is an spagetti code and not working.// Use function to display menu, and display game rules,// Use different color for text display.// fix it so it works any way you like./*HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // Write 16 lines in 16 different colors. for (int color = 0; color < 16; color++) { SetConsoleTextAttribute (screen, color); cout << " Hello World!" << endl; Sleep(400); // Pause between lines to watch them appear } // Restore the normal text color) SetConsoleTextAttribute(screen, 7);*/#include <iostream>#include <windows.h>using namespace std;int main(){ //textbackground(WHITE); //textcolor(RED); system("cls"); char ch, a[20], ch2; int num = 100, rnum, guess, count, ch1, c = 0; cout << "**********************************************************"<<endl; cout << "*…Passwords, again Learning objectives In this lab, you will practice: writing a function to match the specifications using string concatenation to generate a new return value writing your code a module Instructions Write a function create_password(pet_name, fav_number) that will return a password with the following pattern: : fav_number followed by the pet_name followed by the underscore and fav_number (see example below). Create a program that reads pet name and favorite number from the user, uses the function above, and uses the return value to output: Your new password is "3Angel_3". Example Input: Angel 3 Output: Your new password is "3Angel_3". Note: Your program must define and call the following function: def create_password(pet_name, fav_number) Wrong code below: #create function newPassworddef newPassword(petName, favouriteNumber): #return return favouriteNumber + petName + "_" + favouriteNumber if __name__ == '__main__': #enter your pet name…Passwords, again Learning objectives In this lab, you will practice: writing a function to match the specifications using string concatenation to generate a new return value writing your code a module Instructions Write a function create_password(pet_name, fav_number) that will return a password with the following pattern: : fav_number followed by the pet_name followed by the underscore and fav_number (see example below). Create a program that reads pet name and favorite number from the user, uses the function above, and uses the return value to output: Your new password is "3Angel_3". Example Input: Angel 3 Output: Your new password is "3Angel_3". Note: Your program must define and call the following function: def create_password(pet_name, fav_number) # Define your function here. if __name__ == '__main__': # Type your code here.
- Passwords, again Learning objectives In this lab, you will practice: writing a function to match the specifications using string concatenation to generate a new return value writing your code a module Instructions Write a function create_password(pet_name, fav_number) that will return a password with the following pattern: : fav_number followed by the pet_name followed by the underscore and fav_number (see example below). Create a program that reads pet name and favorite number from the user, uses the function above, and uses the return value to output: Your new password is "3Angel_3". Example Input: Angel 3 Output: Your new password is "3Angel_3". Note: Your program must define and call the following function: def create_password(pet_name, fav_number)A prime number is an integer value that is only divisible by 1 and itself. 2, 3, 5, 7, and 11 are examples of prime numbers. You have been provided with two function definitions: The is_prime () function takes an integer parameter number, and returns True if number is prime and False otherwise. The get_next_prime () function also takes a single integer parameter number, and returns the first prime number larger than it. You must not change the implementation of these 2 functions. Complete the get_primes_list() function that takes a single list of integers called numbers as parameter. You can assume that the integer items in this list will be non-negative. The function must update this list so that items that are not prime numbers are updated to the first prime number larger than them. To implement this function you must call both the is_prime () and get_next_prime () functions. Some examples of the function being called are shown below. Note: the get_primes_list() function does not…Basic Variable Assignment A student learning JavaScript was trying to make a function. His code should concatenate a passed string name with string "Edabit" and store it in a variable called result. He needs your help to fix this code. Examples nameString("Mubashir") "MubashirEdabit" nameString("Matt") → "MattEdabit" nameString("javaScript")"javaScriptEdabit"