Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I need to modify the code shown so that it can perform what is requested in number 7. Please use java and use simple

Hi, I need to modify the code shown so that it can perform what is requested in number 7. Please use java and use simple operations.
image text in transcribed
Try This 21 Compute the distance to a lightning strike whose sound takes 7.2 seconds to reach you. * olass Sound \{ public static void main (String[] args) \{ double distance; distance =7.21100 System.out.println("The lightning is approximately " + distance + " feet away."); 6. Compile and run the program. The following result is displayed: |The lighting is approximately 7920.0 feet away. 7. Extra challenge: You can compute the distance to a large object, such as a rock wall, by timing the echo. For example, if you clap your hands and time how long it takes for you to hear the echo, then you know the total roundtrip time. Dividing this value by 2 yields the time it takes the sound to go one way. You can then use this value to compute the distance to the object. Modify the preceding program so that it computes the distance, assuming that the time interval is that of an echo

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions