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

  Design and code a new function that accepts as parameters

design and code a new function that accepts as parameters the gross pay by value and the federal tax state tax local

  Computes the measure of an object.

This program tests the measurement of rectangles by perimeter.

  Write statements that assign random integers to the variable

Write statements that assign Random integers to the variable n in the following ranges.

  Draw the heap

Eric Rowe Starting with an empty minheap, draw the heap after each the completion of the following operations  and repeat for a maxheap (replace removeMin() with removeMax()). Upload your drawings here. Hand drawn is fine:

  How can the code be corrected?

In some of the compilers the integer division returns an integer and hence cannot be stored in a float variable and to correct this you need to change the second line here with "float x=1.0/a;". Adding ".0" to 1 will make a difference.

  Show the items by zone or location within the store

There is other information. Some people shop on a budget so they need the price and the sale price. Use an array or vector to hold the list of items. The display should show the items by zone or location within the store. (Display the output by loc..

  Determining the types of employees

An organization has two types of employees, salaried and wage earning. Both the types of employees have some common properties, such as employee code, employee name, and employee address.

  Include the iostream, fstream, string, and cctype libraries

1. Include the iostream, fstream, string, and cctype libraries in your program.

  Computer programming

Computer programming

  Create an output array using input

create an output array using input x values 1 through 10.

  Prevent illegal moves without crashing

Your program must gracefully handle the case when a player tries to add a non-number to a square, or add a number that violates the Sudoku rules. It should prevent illegal moves without crashing.

  Write a c function void print_triangle(int n)

Write a C function void print_triangle(int n) that prints a triangular pattern of asterisks of height n and width 2 * n + 1 with one asterisk in the first line, three in the second line, etc.,

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