Answered step by step
Verified Expert Solution
Question
1 Approved Answer
On a piano, a key has a frequency, say f 0 . Each higher key ( black or white ) has a frequency of f
On a piano, a key has a frequency, say f Each higher key black or white has a frequency of f rn where n is the distance number of keys from that key, and r is Given an initial key frequency, output that frequency and the next higher key frequencies.
Output all frequencies with five digits after the decimal point, which can be achieved as follows:
Put frequency to output with decimal places
Ex: If the input is:
which is the A key near the middle of a piano keyboard the output is:
Note: Use one statement to compute r using the RaiseToPower function. Then use that r in subsequent statements that use the formula fn f rn with n being and finally
Interesting Fact: Floating point numbers are stored in the computer with the maximum precision the computer supports. We use floating point numbers keeping that precision for all the mathematical operations, and when we want to display the output for people, we display only the number of decimal points that people want to see. If we were displaying an amount that represented money, for example, we would display dollars and cents, that is digits after the decimal place. In this program, we are doing scientific calculations, and so we decided in this program to display digits after the decimal place.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started