# writting a program

Speed of Sound. Sound travels through air as a result of collisions between the molecules in the air. The temperature of the air affects the speed of the molecules, which in turn affects the speed of sound. The velocity of sound in dry air can be approximated by the formula:

velocity = 331.3 + 0.61 × T

where Tc is the temperature of the air in degrees Celsius and the velocity is in meters/second.

Write a program that prompts the user for a starting and an ending temperature. Within this temperature range, the program should output the temperature and the corresponding velocity in one degree increments. In the example below, the user entered 0 as the start temperature and 2 as the end temperature:
Enter the starting temperature, in degrees Celsius:  0
Enter the ending temperature, in degrees Celsius:  2
At 0 degrees Celsius the velocity of sound is 331.3 m/s
At 1 degrees Celsius the velocity of sound is 331.9 m/s
At 2 degrees Celsius the velocity of sound is 332.5 m/s

Input Details: The input will consist of two integers, both responses to program prompts.

Output Details: The program uses the prompts shown in the example above. The output percentage must have one digit past the decimal point.

1. 👍 0
2. 👎 0
3. 👁 922
1. Sarah, Aymee, Abby:
I hope you realize that at this forum, we do not write the programme for you.
Here we give help in different ways,
- understand the problem in hand,
- analyze the requirement
- comment on any proposed solution or help with an algorithm
- resolve errors of syntax, logic or execution
- comment on results
- etc.

You will be expected to take the first step by telling us what you can achieve, and where your difficulties are.

I suggest you start with posting a pseudocode for your problem if you would like assistance. If you can post code, that would accelerate your project immensely.

1. 👍 0
2. 👎 0
2. #include <iostream>
using namespace std;

int main()
{
double start;
double end;
double velocity;

cout << "Enter the starting temperature, ";
cin >> start;

cout << "in degrees Celsius: Enter the ending temperature, in degrees Celsius: ";
cin >> end;

while(start <= end)
{
velocity = 331.3 + 0.61 * start;

cout << "At " << start
<< " degrees Celsius the velocity of sound is "
<< velocity << " m/s" << endl;

start++;
}

return 0;
}

I wrote the code but it seem to no display 346.6 , 347.2 , and 347.8

1. 👍 0
2. 👎 0

## Similar Questions

1. ### Science--HELP!!

1. In which of the following situations is a sound wave most likely to travel through air? A) An alarm clock rings in a vacuum. B) A giant star explodes. C) A grasshopper eats a leaf. D) An astronaut uses tools in space. 2. Which

2. ### algebra

Sound travels about 340 m / s. The function d (t) = 340t gives the distance d (t), in meters, that sound travels in t seconds. How far does sound travel 59 s? ​d(59​)=? meters

3. ### physics

A spelunker drops a stone from rest into a hole. The speed of sound is 343 m/s in air, and the sound of the stone striking the bottom is heard 1.50s after the stone is dropped. How deep is the hole? how can i use the speed of

4. ### physcial science

What are the wavelength limits of the audible range of the sound spectrum? (Use the speed of sound in air. The speed of sound in air is 344 m/s. The audible range of the sound spectrum contains frequencies as low as 30 Hz and as

1. What is true about X-rays and microwaves? a. X-rays have greater speed than microwaves. b. X-rays have greater amplitude than microwaves. c. X-rays have greater frequency than microwaves. d. X-rays have greater wavelength than

2. ### Science HW - - - check my answers?

1. Compare the two light waves above. Which wave would produce the brightest light and which wave would have the least energy? a. wave A; wave A b. wave A; wave B c. wave B; wave A d. wave B; wave B 2. Which waves have the longest

3. ### physics

A sound wave travels in air at a frequency of 500 Hz. If part of the wave travels from air into water, does its frequency change? Does its wavelength change? Note that the speed of sound in air is about 340 m/s, whereas the speed

4. ### Physics

A rock is dropped into a well, and a splash was heard 3 seconds later. If sound travels in air at 344 m/s, A) How deep is the well? B) What are the final positions of the Rock and the Sound? (Rock = Yfr; Sound = Yfs) Known

1. ### physics

Suppose you are stopped for a traffic light, and a fast ambulance approaches you from behind with a speed of 34.0 m/s. The siren on the ambulance produces sound with a frequency of 960 Hz. The speed of sound in air is 343 m/s.

2. ### Science

14. The speed of sound depends on (1 point) A.the loudness of the sound. B.the pitch of the sound. C.the source of the sound.*** D.the properties of the medium it travels through