Write a program class the speed of sound

Assignment Help C/C++ Programming
Reference no: EM13998901

The speed of sound depends on the material the sound is passing through. Below is the approximate speed of sound (in feet per second) for air, water and steel:

air: 1,100 feet per second
water: 4,900 feet per second
steel: 16,400 feet per second

Write a program class The Speed Of Sound that asks the user to enter "air", "water", or "steel", and the distance that a sound wave will travel in the medium. The program should then display the amount of time it will take.

You can calculate the amount of time it takes sound to travel in air with the following formula: time = distance/1,100
You can calculate the amount of time it takes sound to travel in watert with the following formula: time = distance/4,900
You can calculate the amount of time it takes sound to travel in steel with the following formula: time = distance/16,400

Prompts And Output . The program prompts for the medium with: "Enter one of the following: air, water, or steel: " and reads the medium. If the medium is not air, water or steel the program prints the message : "Sorry, you must enter air, water, or steel." an nothing else. Otherwise the program prompts for the distance with ("Enter the distance the sound wave will travel: " and reads it in and then prints "It will take x seconds." where x is the time calculated by your program .

Reference no: EM13998901

Questions Cloud

What are the pros and cons of trade restrictions : What are the pros and cons of trade restrictions? What are the pros and cons of free trade? Which is better in your opinion?
Account for the difference in wages between two industries : What may account for the difference in the wages between two industries that have been highly competitive? Identify and describe each factor and explain its effect on wages. If you make any assumptions about the scenario, state them.
Calculate annual depreciation for the five year : Calculate annual depreciation for the five-year life of the van using each of the following methods. Round all computations to the nearest dollar.
Describe how the agency implements the relevant law : As the human resources manager, it is your responsibility to keep all human resources employees informed about current employment law.
Write a program class the speed of sound : Write a program class The Speed Of Sound that asks the user to enter "air", "water", or "steel", and the distance that a sound wave will travel in the medium. The program should then display the amount of time it will take.
What is the present worth of a series : What is the present worth of a series that gives you $56 in period 1 and then gives you $1 more each time period until period 100 when the interest rate is 5%?
Explain how you find the winning strategy : This game is adopted from episode six of the Survivor Thailand television series that aired in fall 2002. Two players alternate in taking turns to remove some number of flags from a field with 31 flags. Each time it is a player’s turn, he may choose ..
Comparison of two hospitals using quality check function : Perform a comparison of two hospitals using the "Quality Check" function. Prepare a 5-6 page paper based on the following: Select two hospitals to compare in the state you have chosen (click white box next to hospital name to compare)
Factor notation the present worth of a cash flow : How would you describe in factor notation the present worth of a cash flow that gives you $10 in periods zero through 20, then in period 21 gives you $8, in period 22 gives $6, and so on, until period 24 when you recieve $2.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Binary tree routines in c++ that will handle single word

Attached is the input file. The commands should be executed in the order given. Where it says an order type such as inorder, that means to print the tree so far, in that way.

  Computer graphicsdevelop a simple interactive

computer graphicsdevelop a simple interactive two-dimensional spaceship deck plan editor using opengl and glut. your

  Design a solution that prints the amount

Design a solution that prints the amount of pay a commissioned salesperson takes home. The more sales documented, the larger the commission rate. Allow the user to input a total sales amount for the week. Compute the commission based on the follow..

  What is a cell reference

What is a cell reference (also called a cell address) and what is the significance of being able to use them in spreadsheet formulas?

  Program that declares three single dimensional arrays

In the gallons array store the numbers 10.3, 15.7, 14.9, 10.7 and 8.4. Each element of the mpg array should be calculated as the corresponding element of the miles array divided by the equivalent element gallons array; for example mpg[0] = miles [..

  Recognize a string typed in as a valid or invalid

Use regex to recognize valid Social Security numbers.  A valid Social Security number consists of three digits, an optional hyphen, two digits, an optional hyphen, and four digits.

  What is the effective access time for memory

Let the page fault service time be 10 millisecond(ms) in a computer with average memory access time being 20 nanosecond(ns). If one page fault is generated for every 106 memory accesses, what is the effective access time for memory?

  Example of a program that contains an algorithm

Provide an example of a program that contains an algorithm whose Big-Θ is exponential. Clearly explain what n represents in your program. Make some assumption about how long it would take to execute one of the operations that you are counting.

  Create a piggy bank

Prepare a piggy bank using Visual C++. The code requires to be separated into a header file and a driver.cpp using implementation.

  Write a student class in java that implements the interface

A public int compareTo(Object object) that will compare two Student objects based on their student Ids.

  Use structures to create c program to compute student record

Explain the following and give their suitable syntax. A pointer. Use structures to create C program to compute and store student records of class.

  Write menu driven program that make coffee shop operational

Write a menu-driven program that will make the coffee shop operational and Buy coffee in any size and in any number of cups.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd