Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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

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

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

5. Our efficiency focus eliminates free time for fresh thinking.

Answered: 1 week ago