2.15 LAB: Musical note frequencies On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * rn, where n is the distance (number of keys) from that key, and r is 2(1/12). Given an initial key frequency, output that frequency and the next 4 higher key frequencies. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
Q: A palindromic prime is a prime number and also palindromic. For example, 131 is a prime and also a…
A: Since programming language not mentioned, using C++
Q: 3. Scientific notation is a way to express numbers that are too large in a more convenient decimal…
A:
Q: Assume that nextWord is a String variable that has been given a String value consisting entirely of…
A: Assume that nextWord is a String variable that has been given a String value consisting entirely…
Q: 1. Write program to generate random numbers in different ranges and display the number: (a) a number…
A: Java program to find random value in different range
Q: I cant get it right. Modify the BarChart program from Chapter 6 Exercise 13 to accept the number…
A: Algorithm: Start Read points scored by each player in a season Divide the points of each player by…
Q: Q7: Write a program that reads a collection of car speeds as long as the speeds do not exceed 100…
A: Program Approach: Including necessary header files Using namespace for standard input output…
Q: Assume that int a[ 2 ][ 2 ] = { { 1, 2 }, { 3, 4 } }; the value of a[ 1, 1 ] = ______;
A: #include<stdio.h> int main(){ int i=0,j=0; int arr[2][2]={{1,2},{3,4}};…
Q: What will be the value of a, b, c after the execution of the followings int a=5, b=7, c=111; c =++a…
A: The values of a, b, and c after the execution of given statements are: a: 6 b: 6 c: 2
Q: Q: Find the results of A , B, C main () {int A,B,C; float x=-2.64; float y=3.75; A=floor(x);…
A: Introduction of the Program: The C++ program uses the concept of the floor, ceil, round function.…
Q: Write a program that takes a date as input and outputs the date's season. The input is a string to…
A: To write python code for display the seasons accordingly.
Q: Description: The Fibonacci numbers are stated as an infinite sequence starting with 0 and 1, which…
A: Main.java package application; import javafx.application.Application;import…
Q: int s(int *a, int *b) *a=*a+*b; *b=*a-*b;
A: Lets see the solution in the next steps
Q: HW: Q5: Write a program to calculate the B power of Afor now-aegative value of B. 4sAxAra.x4 Wilhout…
A: NOTE: We’ll answer the first question since the exact one wasn’t specified. Please submit a new…
Q: 13. Write a program that reads in two integers and determines and prints if the first is a factorial…
A: Required: A program to read two integers and check if the first is a factorial of the second or not.…
Q: Q6: Write a program to find and print the value of (f) from the following equations for Fourteen…
A: Introduction:- Below is the complete solution with explanation for the given question in detail.…
Q: We usually write numbers in decimal form (or base 10), meaning numbers are composed using 10…
A: Answers: we have to provide the detailed solution in the below Picture: Part a)
Q: Voltage readings are obtained from an electrical substation once every hour for six hours Write a…
A: The Program language is not mentioned here. So, I am using C language to answer your question. The C…
Q: 4.18 LAB: Exact change Write a program with total change amount as an integer input, and output the…
A: Given The answer is given below.
Q: Question in Image. I was wondering why they are not equal even thought their contents are the same
A: Code:
Q: c++ Given two sequences with n integers between 0 and 9, interpreted as two n-digit integers,…
A: I have generated random numbers for n-sequence numbers. The numbers can be entered from the user as…
Q: Three variables, x, y, and z, supposedly hold strings of digits, suitable for converting to…
A: Below is the required python program: - Approach: - Ask the user to enter the value of x, y, and z.…
Q: 2. int a = 0, i = N; while (i > 0) { a += i; i /= 2;
A: As per our guideline we are supposed to answer only first question, please re upload another…
Q: Question 5: Write a program that inputs four strings that represent floating-point values, converts…
A: NOTE: SINCE THE LANGUAGE OF THE CODE IS NOT MENTIONED, I HAVE USED C FOR THE SOLUTION Define header…
Q: 2.16 LAB: Musical note frequencies On a piano, a key has a frequency, say f0. Each higher key (black…
A: Required: python On a piano, a key has a frequency, say fO. Each higher key (black or white) has a…
Q: (b) In a crypto-arithmetic puzzle, a mathematical equation is written using letters. Each letter can…
A: Python Program: From itertools import combinations, permutations x = input("Enter the value of x: ")…
Q: 5. Given variables int areaBound and int sum, write a snippet of code that assigns to sum the result…
A: Here in this question we have asked to write a snippet of code that use while loop and Initially…
Q: 2. - Write a program that displays the area and perimeter of a rectangle with the width of 5 And…
A: width=5; #initialize widthheight=7.5; #initialize height area=width*height; #calculate area…
Q: 3.39 The computer game function collision() checks whether two circular objects col- lide; it…
A: To find collision of two circles we calculate distance between two centers and sum of two radius…
Q: Complete the following program that collects an input word from the keyboard and finds if the word…
A: Solution Code word = input("enter")is_palindrome = Truei=-1for j in range(len(word)): if word[j]…
Q: 4.Write a program that displays a Pascal triangle. The program prompts the user to enter the number…
A: The answer is in below steps:
Q: Q3:1- Write a program which will read in two real numbers representing the length and width of a…
A: Fortan code to solve the given problem is as given below.
Q: 21.4 LAB: Parsing dates (Use Python) Write a program to read dates from input, one date per line.…
A: Here in the main block, I have created an infinite while loop. Next inside the loop, I have taken…
Q: An Armstrong number is a number such that the sum ! of its digits raised to the third power is equal…
A: As the programming language is not mentioned so I am using C++ language to write a code. Program…
Q: What will be the values of the variables a, b and c after executing the following code? int a: int…
A: Answer in step2
Q: 9. Write a program that prints the numbers 1 to 4 on the same line with each pair of adjacent…
A: C++ program for the given problem:-
Q: algA2 (int[] A){ int i = 1; while (i < A.length){ for (int j = 0; j < A.length; j++){ A[0] = A[0] *…
A: Consider the given Code:
Q: Write a program that takes a date as input and outputs the date's season. The input is a string to…
A: CODE:- input_month = input()input_day = int(input())month= ('January', 'February','March', 'April'…
Q: Q5/ 1. 1. Write a program to read three marks and calculate the average. If the student's average is…
A: Since no programming language is mentioned, I am using python. As per our guidelines, we are…
Q: x=2.9 a=floor(x) b=ceil(x) c=round(x) d=int(x) print(a,',',c,',',b,',",d)
A:
Q: Q2) Write a program to read a group of numbers between 1 to 100, then find the sum of the even…
A: "Since you have not mention any programming language, so we will write our program in C++ language."…
Q: Q6: Write a program to find and print the value of (f) from the following cquations for Fourteen…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read the value of θ…
Q: 6. (18) Write a Java program (18 = 3(a) + 2(b) + 3(c) + 3(d) + 3(e) + 4(f) a. Define 2 String…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: Q5: Ask the user to enter five capital letters (A..Z), and check if the letters are in an ascending…
A: According to the provided information: We need to create a program that will take five capital…
Q: 2. Let x be the first three digits of your matric number, AND y be the last three digits of your…
A: I am considering the matric number as 2210039 Now x = 221 and y - 039 we change 0 in y as 2 so, x =…
Q: 2. Write a program to find the Greatest Common Divisor (GCD) of two numbers.
A: Here I have defined the function named gcd(). This function takes 2 numbers as input parameters and…
Q: Create a c++ langauge that ask the user to enter a name (one word only) and then print the name in…
A: Code: #include <iostream>#include <bits/stdc++.h>using namespace std; int main(){…
Q: Q2- Write a program to read a number (n). Then print all numbers from 0 to n that are not equal to 1…
A: #Note no programming is mentioned so i was used python programming language for i in…
Q: 15. Let C be the set of all Circles in the world, and S be the set of all Squares in the world. Vx E…
A: In questions with many questions, we must answer first one
Q: E2.7 Write a program that prompts the user for a radius and then prints • The area and circumference…
A: We are going to take radius as input from the user and then we will find out area of the circle,…
2.15 LAB: Musical note frequencies
On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * rn, where n is the distance (number of keys) from that key, and r is 2(1/12). Given an initial key frequency, output that frequency and the next 4 higher key frequencies.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print(f'{your_value1:.2f} {your_value2:.2f} {your_value3:.2f} {your_value4:.2f} {your_value5:.2f}')
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following fashion:A, B, and C = 2D, E, and F = 3G, H, and I = 4J, K, and L = 5M, N, and O = 6P, Q, R, and S = 7T, U, and V = 8W, X, Y, and Z = 9Create an application that lets the user enter a 10-character telephone number in the format XXX-XXX-XXXX. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. For example, if the user enters 555-GET-FOOD, the application should display 555-438-3663.Assume int[][] x = {{1, 2}, {3, 4}, {5, 6}}, what are x.length are x[0].length? 5 3 and 2 4 2 and 1 3 2 and 3 2 2 and 2 1 3 and 31- Given an input consisting of one or more sets of strings, followed by a final line containing only the value 0. Each set starts with a line containing an integer, k, which is the number of strings in the set, followed by k strings, one per line. For example, if your input is: Input = { "7", "Bo", "Jean", "Marybeth", "Kevin", "Claude", "William", "Pat", "6", "Jim", "Ben", "Annabelle", "Zoe", "Joey", "Frederick", "5", "John", "Billy", "Fran", "Stant", "Cece", "2", "Jones", "Bibi", "0" } Your output should look like that: 2- Given the sorted input from question 1, write a new code such that the shorter strings go on the top and bottom and the longer strings sit in the middle. In other words, each pair of names belongs on opposite ends of the list, and the first name in the pair is always in the top part of the list. For example, in Set 1 below, Bob and Joe are the first pair, Jean and Kevin the second pair, etc. Your output should look like the sample below.…
- Assume that nextWord is a String variable that has been given a String value consisting entirely of letters. Write some Java code that outputs the message "First half of the alphabet", provided nextWord precedes "N" in alphabetic ordering. If nextWord does not precede "N" in alphabetic ordering, the code should output "Second half of the alphabet". (Note that "N" uses double quotes to produce a String value, as opposed to using single quotes to produce a char value.)C++ Question, Write a Computer Code: Let l be a line in the x-y plane. If l is a vertical line, its equation is x = a for some real number a. Suppose l is not a vertical line and its slope is m. Then the equation of l is y = mx + b, where b is the y-intercept. If l passes through the point (x₀, y₀), the equation of l can be written as y - y₀ = m(x - x₀). If (x₁, y₁) and (x₂, y₂) are two points in the x-y plane and x₁ ≠ x₂, the slope of line passing through these points is m = (y₂ - y₁)/(x₂ - x₁).1. Write a Python regex pattern that matches a valid email address, assuming that an email address consists of a username, followed by the "@" symbol, followed by a domain name, which in turn consists of one or more subdomains separated by dots, and ending with a top-level domain (e.g., .com, .org, .edu, etc.). 2. Using the re.findall() function in Python, write a Python code snippet that takes the text string and the regex pattern from Q4 and returns a list of all the email addresses found in the string. 3. Suppose you want to modify the regex pattern from Q4 to also match email addresses that contain hyphens ("-") in the username and/or domain name. What changes would you make to the pattern, and why? 4. Using the modified regex pattern from Q6, write a Python code snippet that takes the text string and the modified regex pattern, and returns a list of all the email addresses found in the string. Note: You can assume that the text string contains valid email addresses separated by…
- A palindromic prime is a prime number and also palindromic. For example, 131 is a prime and also a palindromic prime, as are 313 and 757. Write a program that displays the first 120 palindromic prime numbers. Display 10 numbers per line, separated by exactly one space, as follows: 3 5 7 11 101 131 151 181 191 313 353 373 383 727 757 787 797 919 9291 int[] a = new int[n]; 2 a[0] = 0; a[1] = 1; 3 int x = 0; 4 for (int i = 2; i < n; i++) { 5 x = 3 * (i-1) * (i-1); 6 x += 3 * i - 2; 7 a[i] = a[i-1] + x; 8 } The code can be simplified by replacing lines 5, 6, 7 with a single line of code. Write the single line of code below:Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following fashion: A, B, and C 2 D, E, and F 3 G, H, and I 4 J, K, and L 5 M, N, and O 6 P, Q, R, and S 7 T, U, and V 8 W, X, Y, and Z 9 Write a program that asks the user to enter a 10-character telephone number in the format XXX-XXX-XXXX. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. For example, if the user enters 555-GET-FOOD the application should display 555-438-3663. Gaddis Tony. Starting Out with Python (2-downloads) (p. 367). Pearson Education. Kindle Edition.
- Encryption is commonly used to disguise messages on the internet. A Caesar cipher performs a shift of all of the characters in a string (based on their ASCII values, see Table 2.1), e.g. h e l l o → m j q q tThe example shows a shift with a distance of 5characters, i.e. h(ASCII:104) → m(ASCII:109)Write a C/C++ program that asks the user to input a line of plaintext and the distance value and outputs an encrypted text using a Caesar cipher, with the ASCII values range from 0 through 127. Use underscores (ASCII: 95) to represent space characters.Underscore characters should not be encrypted, and any character that is encrypted may not become an underscore. In this case, the character should be changed to the next character in the ASCII table.The program should work for any printable characters.NB: No strings (datatype) or library functions may be used.See Figure 2.1 for example output.Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following way: A, B, and C = 2 D, E, and F = 3 G, H, and I = 4 J, K, and L = 5 M, N, and O = 6 P, Q, R, and S = 7 T, U and V = 8 W, X, Y, Z = 9 Write a program that asks the user to enter a telephone number. The program should display the telephone number with all alphabetic characters that appeared in the original translated to their numeric equivalent. Do not translate characters other than letters. Ex: If the input is: 555-GET-food the output is: 555-438-3663 PythonThree variables, x, y, and z, supposedly hold strings of digits, suitable for converting to integers. Write a code that converts these variables into integers and print sum of the three integers. However, if any variable has a value that cannot be converted to an integer, print out, the string "bad value(s) in:" followed by the names of the variables that have bad values (separated by spaces, in alphabetically ascending order). For example, if the values of x, y, and z were respectively "3", "9", "2" then the number 14 would be printed; but if the values were "abc", "15", "boo" then the output would be: bad value(s) in: x z