IN COARAL 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.0/12.0). Given an initial key frequency, output that frequency and the next 4 higher key frequencies. Output all frequencies with five digits after the decimal point, which can be achieved as follows: Put frequency to output with 5 decimal places Ex: If the input is: 440.0 (which is the A key near the middle of a piano keyboard), the output is: 440.00000 466.16376 493.88330 523.25113 554.36526 Note: Use one statement to compute r = 2(1.0/12.0) using the RaiseToPower() function. Then use that r in subsequent statements that use the formula fn = f0 * rn with n being 1, 2, 3, and finally 4
IN COARAL
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.0/12.0). Given an initial key frequency, output that frequency and the next 4 higher key frequencies.
Output all frequencies with five digits after the decimal point, which can be achieved as follows:
Put frequency to output with 5 decimal places
Ex: If the input is:
440.0
(which is the A key near the middle of a piano keyboard), the output is:
440.00000 466.16376 493.88330 523.25113 554.36526
Note: Use one statement to compute r = 2(1.0/12.0) using the RaiseToPower() function. Then use that r in subsequent statements that use the formula fn = f0 * rn with n being 1, 2, 3, and finally 4.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
Oh, and I am having a white space issue at the end. All the answers work out. However, there is a space at the end and I can not figure out what you did to tace it down. The " " at the end works very well for all the spacing until you get to the end. The training program goes crazy when it sees the added space. Gotta love Zybooks....