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
Svetach [21]
3 years ago
13

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. Ex: If the input is 440 (the A key near the middle of a piano keyboard), the output is: 440 466.1637615180899 493.8833012561241 523.2511306011974 554.3652619537443 Note: Use one statement to compute r = 2(1/12). Then use that r in subsequent statements that use the formula fn = f0 * rn with n being 1, 2, 3, and finally 4. Note: Import the math module as part of your code to help you compute r = 2(1/12)
Mathematics
1 answer:
ICE Princess25 [194]3 years ago
6 0

Answer:

Program in Java:

import java.util.Scanner;

import java.lang.Math;

public class MyClass {

public static void main(String args[]) {

Scanner input = new Scanner(System.in);

float f0; double r=0.0;

System.out.print("Initial Key Frequency: ");

f0 = input.nextFloat();

int numkey = 1;

System.out.print(f0+" ");

r= Math.pow(2,(1.0/12.0));

while(numkey<=4){

f0*=r;

System.out.print(f0+ " ");

numkey++;

}

}

}

Step-by-step explanation:

This line declares f0 as float and r as double. f0 represents the initial key frequency

float f0; double r=0.0;

This line prompts the user for initial key frequency

System.out.print("Initial Key Frequency: ");

This line gets the initial key frequency from the user

f0 = input.nextFloat();

This declares numkey as integer and also initializes it to 1

int numkey = 1;

This prints the initial key

System.out.print(f0+" ");

This calculates r

r= Math.pow(2,(1.0/12.0));

The following iteration calculates and prints the next 4 key frequencies

<em>while(numkey<=4){</em>

<em> f0*=r;</em>

<em> System.out.print(f0+ " ");</em>

<em> numkey++;</em>

<em>}</em>

}

}

You might be interested in
Victor went for 1 run lats week . it was 3.5 km long . terrell went for 3 runs last week . each run was 1,250m long . wich perso
valina [46]
1 km = 1,000m
Victor: 3.5 km = 3,500m
Terrel: 1,250m *3 = 3,750m

Terrel ran a greater total distance


7 0
3 years ago
F the following fractions: 3/7, 5/8, 7/13, and 11/19, which is the largest?
Masteriza [31]

Answer:

5/8

Step-by-step explanation:

In decimals from 3/7 to 7/13 they are:

.42, .62, .53, and .57.

4 0
3 years ago
Read 2 more answers
Math! help!! will mark brainliest!! due today!!
MariettaO [177]
6 hours is 3
7 hours is 6
8 hours is 7
And 9 hours is 4
6 0
3 years ago
State if the two triangles are congruent. If they are, state how you know.<br> 5)
Lapatulllka [165]

Answer:

Two triangles are congruent if they meet one of the following criteria. : All three pairs of corresponding sides are equal. : Two pairs of corresponding sides and the corresponding angles between them are equal. ... and another pair of corresponding sides are equal in two right triangles.

5 0
3 years ago
What is the volume of the stereo speaker?
Tpy6a [65]
12 x 12 x 24 = 3456
so the volume is 3456 in³
6 0
3 years ago
Read 2 more answers
Other questions:
  • Kyle has 125 marbles. Fifty of these marbles are red and the reat are other colors. What is the ratio of the nunber of red marbl
    6·1 answer
  • Carlos has 30 packs of shirts he puts 10 in each 5 boxes does he left overs
    15·1 answer
  • What is the surface area of a triangular pyramid if each face has an area of 80 m2?
    9·1 answer
  • Factor the expression using the GFC 8 - 22a
    7·1 answer
  • Please tell me which are correct
    15·2 answers
  • Find the zeros of the quadratic function
    10·1 answer
  • Son las partes de las que se compone el reporte de la encuesta:
    13·1 answer
  • Slope from graph HELP NOWW PLS
    8·1 answer
  • Please help I will make you brainliest
    14·2 answers
  • Justin prepares 229 hamburgers for a company picnic.If buns come in packages of 8 how many will be left over?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!