Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this The following table shows the approximate speed of sound in air, water, and steel. Speed 1,100 feet per second 4,900

I need help with this image text in transcribed
image text in transcribed
The following table shows the approximate speed of sound in air, water, and steel. Speed 1,100 feet per second 4,900 feet per second 16,400 feet per second Medium Water Steel Design a class that stores in a distance field, the distance (in feet), traveled by a sound wave. The class should have the appropriate accessor and mutator methods for this field. In addition, the class should have the following methods: getSpeedInAir. This method should return the number of seconds it would take a sound wave to travel, in air, the distance stored in the distance field. The formula to calculate the amount of time it wil take the sound wave to travel the specified distance in air is: Time distance/1100 getSpeedIn water. This method should return the number ofseconds it would take a sound wave to travel, in water, the distance stored in the distance field. The formula to calculate the amount of time it will take the sound wave to travel the specified distance in water is Time distance/4900 getSpeedInSteel. This method should return the number of seconds it would take a sound wave to travel, in steel, the distance stored in the distance field. The formula to calculate the amount of time it will take the sound wave to travel the specified distance in air is * Time distance/16400 program should display a menu Write another program to demonstrate the above class. The allowing the user to select air, water, or steel. Once the user has made a selection, he or she should be asked to enter the distance a sound wave will travel in that selected medium. The program will then display the amount of time it will take. Check that the user has selected one of the available choices from the menu. Here is a sample run: Press 1 for Air, 2 for Water and 3 for Steel: 1 What is the distance travelled in Air? 5500 To travel 5500 feet in air, sound wave will take 5.0 seconds. Here is another run: Press 1 for Air, 2 for water and 3 for Steel: 3 What is the distance travelled in Air? 154231 To travel 154231 feet in Steel, sound wave will take 9.4 seconds. Here is another run: Press 1 for Air, 2 for Water and 3 for Steel:0 This is not a valid choice. Please enter either 1, 2 or 3

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

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions