On a piano, a key has a frequency, say fo. Each higher key (black or white) has a frequency of f0 * rn, where n is the distance (number of from that key, and r is 2(1/12). Given an initial key frequency, output that frequency and the next 4 higher key frequencies. keys) Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue); Ex: If the input is: 440.0 (which is the A key near the middle of a piano keyboard), the output is: 440.00 466.16 493.88 523.25 554.37 Note: Use one statement to computer = 2(1.0/12.0) using the pow function. Then use that r in subsequent statements that use the formula f = f0 * rn with n being 1, 2, 3, and finally 4. 1 import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr new Scanner(System.in); /* Type your code here. */ 8 9 10 11 }
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
Java - Musical Note Frequencies
Step by step
Solved in 2 steps with 2 images