problem9_getSoundLevel Sound level L in units of decibel (dB) is determined by L = 20 log10 Po where p is the sound pressure of the sound (in Pascals, abbreviated Pa), and po is a reference sound pressure equal to 20 x 10 -9- (where L is 0 dB). The following table gives descriptions for certain sound levels. Description dB Threshold of pain >= 130 Possible hearing damage >= 120 and < 130 Jack hammer at 1 m >= 100 and < 120 Traffic on a busy roadway at 10 m >= 90 and < 100 Normal conversation >= 60 and < 90 Calm library >= 30 and < 60 Light leaf rustling >= 0 and < 30 Implement a method that reads a value and a unit (either dB or Pa) from the user, and prints a string indicating which of the above sound level categories the sound falls into. If the unit entered is not "dB" or "Pa", print "Invalid unit". If the value entered is negative, print "Invalid sound level". If invalid unit and negative sound level, print "Invalid unit and sound level". Assume no other invalid input will occur. When you print the string, use print instead of println (this will make testing/grading easier, since the newline separator that gets inserted using println varies per platform). Examples: Enter sound level and unit (dB or Pa): 88.3 dB Normal conversation Enter sound level and unit (dB or Pa): 0.001 dB Light leaf rustling Enter sound level and unit (dB or Pa): 0.049 Pa Normal conversation Enter sound level and unit (dB or Pa): 2.5 Pa Jack hammer at 1 m Enter sound level and unit (dB or Pa): 3233.33 dB Threshold of pain Enter sound level and unit (dB or Pa): -0.045 m Invalid unit and sound level

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Java

public static void problem9_getSoundLevel(Scanner in) {
// FILL IN
}
Transcribed Image Text:public static void problem9_getSoundLevel(Scanner in) { // FILL IN }
problem9_getSoundLevel
Sound level L in units of decibel (dB) is determined by
20 log10
Po
where p is the sound pressure of the sound (in Pascals, abbreviated Pa), and po is a reference sound pressure equal to
20 x 10-0 (where L is 0 dB). The following table gives descriptions for certain sound levels.
Description
dB
Threshold of pain
>= 130
Possible hearing damage
>= 120 and < 130
Jack hammer at 1 m
>= 100 and < 120
Traffic on a busy roadway at 10 m
>= 90 and < 100
Normal conversation
>= 60 and < 90
Calm library
>= 30 and < 60
Light leaf rustling
>= 0 and < 30
Implement a method that reads a value and a unit (either dB or Pa) from the user, and prints a string indicating which of
the above sound level categories the sound falls into. If the unit entered is not "dB" or "Pa", print "Invalid unit". If the
value entered is negative, print "Invalid sound level". If invalid unit and negative sound level, print "Invalid unit and
sound level". Assume no other invalid input will occur.
When you print the string, use print instead of println (this will make testing/grading easier, since the newline
separator that gets inserted using println varies per platform).
Examples:
Enter sound level and unit (dB or Pa): 88.3 dB
Normal conversation
Enter sound level and unit (dB or Pa): 0.001 dB
Light leaf rustling
Enter sound level and unit (dB or Pa): 0.049 Pa
Normal conversation
Enter sound level and unit (dB or Pa): 2.5 Pa
Jack hammer at 1 m
Enter sound level and unit (dB or Pa): 3233.33 dB
Threshold of pain
Enter sound level and unit (dB or Pa): -0.045 m
Invalid unit and sound level
Transcribed Image Text:problem9_getSoundLevel Sound level L in units of decibel (dB) is determined by 20 log10 Po where p is the sound pressure of the sound (in Pascals, abbreviated Pa), and po is a reference sound pressure equal to 20 x 10-0 (where L is 0 dB). The following table gives descriptions for certain sound levels. Description dB Threshold of pain >= 130 Possible hearing damage >= 120 and < 130 Jack hammer at 1 m >= 100 and < 120 Traffic on a busy roadway at 10 m >= 90 and < 100 Normal conversation >= 60 and < 90 Calm library >= 30 and < 60 Light leaf rustling >= 0 and < 30 Implement a method that reads a value and a unit (either dB or Pa) from the user, and prints a string indicating which of the above sound level categories the sound falls into. If the unit entered is not "dB" or "Pa", print "Invalid unit". If the value entered is negative, print "Invalid sound level". If invalid unit and negative sound level, print "Invalid unit and sound level". Assume no other invalid input will occur. When you print the string, use print instead of println (this will make testing/grading easier, since the newline separator that gets inserted using println varies per platform). Examples: Enter sound level and unit (dB or Pa): 88.3 dB Normal conversation Enter sound level and unit (dB or Pa): 0.001 dB Light leaf rustling Enter sound level and unit (dB or Pa): 0.049 Pa Normal conversation Enter sound level and unit (dB or Pa): 2.5 Pa Jack hammer at 1 m Enter sound level and unit (dB or Pa): 3233.33 dB Threshold of pain Enter sound level and unit (dB or Pa): -0.045 m Invalid unit and sound level
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
User Defined DataType
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education