1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Temka [501]
3 years ago
10

On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * r^n, 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. Ex: If the input is 440 (the A key near the middle of a piano keyboard), the output is: 440.0 466.1637615180899 493.8833012561241 523.2511306011974 554.3652619537442 Note: Use one statement to compute r = 2^(1/12) using the RaiseToPower() function. Then use that r in subsequent statements that use the formula fn = f0 * r^n with n being 1, 2, 3, and finally 4.
Computers and Technology
1 answer:
vodomira [7]3 years ago
6 0

Answer:

Following are the code to this question:

import math# import math module

def RaiseToPower():   # defining a function RaiseToPower

   r= math.pow(2,1/12)    # defining r variable that calcualte the decimal point value.

   return r # return r variable value.

f0= float(input()) #defining f0 variable that hold input frequency .

for n in range(0,5):#defining for loop to count all frequency

   fn = f * math.pow(RaiseToPower(),n)    # defining fn variable that calls method RaiseToPower and multiply the value by frequency

   print(fn,end=' ')    # use print method to prints all five frequency

Output:

440

440.0 466.1637615180899 493.8833012561241 523.2511306011974 554.3652619537443

Explanation:

Description of the above python code can be defined as follows:

  • In the above code first we import the package of the math module for converting frequency, after importing package a "RaiseToPower" method is declared, inside the method r variable is declared, that counts decimal value and return its value.
  • In the next step, "f0" a frequency variable is declared that input a value from the user and defined a for loop to in the loop fn variable declared, calls the method and pass its input value and stores its decimal points and at the last print its value.

You might be interested in
The variable 'a' starts with the value 1 The variable 'b' starts with the value 10 The variable 'c' starts with the value 100 Th
Anettt [7]

Answer:

The answer is B = 365

Explanation:

The following variable were initialized:

a = 1

b = 10

c = 100

x = 0

Then we store the value of 'c' times 3 in 'x'

x = 3 * c = 3 * 100 = 300

x = 300

Then we add the value of 'b' times 6 to the value already in 'x'

x = x + 'b' times 6

x = x + (b * 6) = 300 + (10 * 6) = 300 + 60 = 360

x = 360

Then we add the value of 'a' times 5 to the value already in 'x'

x = x + 'a' times 5

x = x + (a * 5) = 360 + (1 * 5) = 360 + 5 = 365

x = 365.

Therefore, the value of 'x' displayed is 365.

4 0
3 years ago
Write a program FindDuplicate.java that reads n integer arguments from the command line into an integer array of length n, where
kozerog [31]

Answer:

  1. public class FindDuplicate{
  2.    public static void main(String[] args) {
  3.        Scanner input = new Scanner(System.in);
  4.        int n = 5;
  5.        int arr[] = new int[n];
  6.        for(int i=0; i < arr.length; i++){
  7.            int inputNum = input.nextInt();
  8.            if(inputNum >=1 && inputNum <=n) {
  9.                arr[i] = inputNum;
  10.            }
  11.        }
  12.        for(int j =0; j < arr.length; j++){
  13.            for(int k = 0; k < arr.length; k++){
  14.                if(j == k){
  15.                    continue;
  16.                }else{
  17.                    if(arr[j] == arr[k]){
  18.                        System.out.println("True");
  19.                        return;
  20.                    }
  21.                }
  22.            }
  23.        }
  24.        System.out.println("False");
  25.    }
  26. }

Explanation:

Firstly, create a Scanner object to get user input (Line 4).

Next, create an array with n-size (Line 7) and then create a for-loop to get user repeatedly enter an integer and assign the input value to the array (Line 9 - 14).

Next, create a double layer for-loop to check the each element in the array against the other elements to see if there is any duplication detected and display "True" (Line 21 - 22). If duplication is found the program will display True and terminate the whole program using return (Line 23). The condition set in Line 18 is to ensure the comparison is not between the same element.

If all the elements in the array are unique the if block (Line 21 - 23) won't run and it will proceed to Line 28 to display message "False".

7 0
3 years ago
What does UDP stand for?
sleet_krkn [62]
User Datagram Protocol
3 0
3 years ago
Read 2 more answers
Round 74,361 to the nearest 10​
grandymaker [24]

Answer:

74,400 i think

Explanation:

8 0
3 years ago
Where should citations be included in your research paper? Select all that apply.
yKpoI14uk [10]

Answer:

it would be the first one because it's the header and that's what applies

5 0
3 years ago
Other questions:
  • PLEASE HELP ITS DRIVERS ED
    8·2 answers
  • What do you call a named collection of data stored on a disk?
    15·1 answer
  • How did voyager 1 and voyager 2 made outer space exploration and easier
    11·1 answer
  • 14<br> Select the correct answer.<br> Which activity is a marketing technique?
    9·1 answer
  • Which element is located on the top left of the Word screen?
    6·1 answer
  • When specifying keywords to conduct an internet search, which of the following parts of speech will be the most useful??
    6·1 answer
  • The Curtis Publishing Company's early marketing research efforts mainly had to do with _____. people who drove automobiles peopl
    10·1 answer
  • How to make a website
    15·2 answers
  • Can you explain the difference between software and hardware? Tell me 3 examples of each one.
    10·1 answer
  • write the definition of a class clock. the class has no constructors and one instance variable of type int called hours.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!