Write a Java program called quest3.java that prompts for and reads in two integer values:

  • The hour (on a 24 hour clock) a noise reading is taken (you may assume the user will enter an integer in the range 0..23, inclusive)
  • The loudness of the noise in decibels (you may assume the user will enter an integer in the range 0..200, inclusive)

Your program needs to calculate if a fine should be levied against the producers of the noise, and what the amount of the fine should be. The program then prints out the fine. The rules for determining the fine are as follows. The amount of a fine depends of the time the noise was produced, and the loudness of the noise. Noise during sleeping time (regarded as being 10pm or later but before 6am) is regarded more seriously than noise at other times. Outside of sleeping time, a noise louder than 90 decibels incurs a $100 fine. During sleeping time, there are two rates of fine: if the noise is from 70 up to 110 decibels, the fine is $200 but if it is 110 decibels or louder, the fine is $300

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.