Question: C++ Coding In this program you will be reading in the number of seconds and then calculating how far sound can travel in a specified

C++ Coding

C++ Coding In this program you will be reading in the numberof seconds and then calculating how far sound can travel in aspecified medium in that many seconds. This part of lesson 5 isgoing to start a little bit differently. In part two you will

In this program you will be reading in the number of seconds and then calculating how far sound can travel in a specified medium in that many seconds. This part of lesson 5 is going to start a little bit differently. In part two you will be creating a program that looks a lot like lesson 5 part 1. The menu will have four items (the mediums will all be gasses at 0 degrees centigrade). Also, you will read in the number of seconds and will then calculate and output the number of meters (not feet) traveled in those seconds. The number of seconds should be in the range 0 to 30 seconds (including both 0 and 30). The seconds are allowed to have a fractional value (example, 2.5). This next one is important. Unlike part one, in part two you MUST use if /else statements to check your menu values (in part one you used a switch statement). We are making you change the menu processing so you can see the way it would be done with a switch statement (part 1) and with if statements (part 2) Finally, you should look at part one and see if you are duplicating code. If you are, try and reduce the duplicated code. You may have to create variables to store intermediate values and you may need to set bool values to indicate that you have valid input values. You can then check the bool value or values later in your program. When we get to functions you will learn a different way to get rid of having to write the same (or very similar) code multiple times. The gasses you will use all assume the speed of sound (at 0 degrees centigrade). The meters traveled per second for each of these gasses is as follows: Medium Speed (Meters per second) Carbon Dioxide 258.0 Air Helium Hydrogen 331.5 972.0 1,270.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!