
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.

Re: Decibel Loudness
Would you like fries with that?
Post your code and ask specific questions, nobody will do your homework for you.

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.

Re: Decibel Loudness
Check out the Math class; it has a log10( ... ) method.
kind regards,
Jos

Re: Decibel Loudness

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 )

Re: Decibel Loudness
Quote:
Originally Posted by
DPdieciocho what do you mean?
Erm, my hoovercraft is full of eels ...
Jos

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.

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

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?

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