You are on page 1of 1

/*angel calderon

cop1000
thursday, april 24, 2008

*/

import java.util.scanner;

public class soundlevel


{

public static void main(string[] args)


{
scanner kbr = new scanner(system.in);

system.out.println("to find a sound's spl at a distance");

system.out.print("- what is the ref. loudness (decibels)? ");


int loudness1 = kbr.nextint();

system.out.print("- what is the ref. distance (meter)? ");


double distance1 = kbr.nextdouble();

system.out.print("- what is the new distance? ");


double distance2 = kbr.nextdouble();

long loudness2 = loudness1 - math.round(20 *


math.log10(distance2/distance1));

system.out.println("\nthe spl of the sound at distance = " + distance2 +


" is " +
loudness2 + " bd ");

You might also like