Decibel Loudness

• 07-03-2013, 12:31 PM
DPdieciocho
Decibel Loudness
The loudness of a sound is measured in units of decibels and is calculated as shown: 10LOG (SL/RL)

SL is the intensity of the sound being measured.
RL is a reference sound intensity level.

Using this formula, calculate and display the decibel loudness of a busy street having a sound intensity of 10,000,000 RL.
• 07-03-2013, 12:41 PM
PhHein
Re: Decibel Loudness
Would you like fries with that?
• 07-03-2013, 12:46 PM
DPdieciocho
Re: Decibel Loudness
Haha. what shall I do? Am I going to enter a value for SL or not?
This is what I already started.

import java.util.*;
import java.math.*;

public class Assignment3 {

public static void main(String[] args){

double decibelLoudness, log=10, sL, rL=10000000;
Scanner input = new Scanner(System.in);
System.out.println("Intensity Sound: ");
sL = input.nextDouble();
decibelLoudness = (Math.log(log) * (sL / rL));
System.out.println("Decibel Loudness " +decibelLoudness);
}
}

I'm not sure about the output eh.
• 07-03-2013, 12:52 PM
JosAH
Re: Decibel Loudness
Check out the Math class; it has a log10( ... ) method.

kind regards,

Jos
• 07-03-2013, 12:56 PM
DPdieciocho
Re: Decibel Loudness
what do you mean?
• 07-03-2013, 01:14 PM
gimbal2
Re: Decibel Loudness
What do you mean, "what do you mean"? Check out the log10 method of the Math class.

Math (Java Platform SE 7 )
• 07-03-2013, 01:37 PM
JosAH
Re: Decibel Loudness
Quote:

Originally Posted by DPdieciocho
what do you mean?

Erm, my hoovercraft is full of eels ...

Jos
• 07-03-2013, 01:47 PM
DPdieciocho
Re: Decibel Loudness
may I know what will be its formula if RL = 10,000,000?
The decibel sound should be 70 if RL = 10,000,000.
• 07-03-2013, 02:13 PM
JosAH
Re: Decibel Loudness
Your representation of a dB formula is inaccurate; it should be dB= 10*log(sl/rl) where log( ... ) is the base 10 logarithm; if sl == 10000000*rl the outcome of the formula is indeed equal to 70. See this link: https://en.wikipedia.org/wiki/Decibel

kind regards,

Jos
• 07-03-2013, 03:56 PM
DPdieciocho
Re: Decibel Loudness
What's wrong with this?

import java.math.*;

public class Assignment3 {

public static void main(String[] args){

double decibelLoudness;
decibelLoudness = (10 * Math.log(10000000));
System.out.println("Decibel Loudness " +decibelLoudness);

}
}

The output should be 70, but why is it 161.18095650.....
Is there something wrong with formula or else something like that?
• 07-03-2013, 04:00 PM
JosAH
Re: Decibel Loudness
You should use the log10( ... ) method; also see one of my other replies and read the API documentation for the Math class. The log( ... ) method uses e as the base for its logarithm, not 10.

kind regards,

Jos