Answered step by step
Verified Expert Solution
Link Copied!

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 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.00000466.16376493.88330523.25113554.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.
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 2 digits after the decimal place. In this program, we are doing scientific calculations, and so we decided in this program to display 5 digits after the decimal place.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 15th International Conference Dasfaa 2010 International Workshops Gdm Benchmarx Mcis Snsmw Diew Udm Tsukuba Japan April 2010 Revised Selected Papers Lncs 6193

Authors: Masatoshi Yoshikawa ,Xiaofeng Meng ,Takayuki Yumoto ,Qiang Ma ,Lifeng Sun ,Chiemi Watanabe

2010th Edition

3642145884, 978-3642145889

More Books

Students also viewed these Databases questions