Concept explainers
The Speed of Sound in Gases
When traveling through a gas, the speed of sound depends primarily on the density of the medium. The less dense the medium, the faster the speed will be. The following table shows the approximate speed of sound at O degrees Celsius, measured in meters per second, when traveling through carbon dioxide, air, helium, and hydrogen.
Medium | Speed (meters per sec) |
Carbon dioxide | 258.0 |
Air | 331.5 |
Helium | 972.0 |
Hydrogen | 1270.0 |
Write a
Input Validation: If the use enters an invalid menu choice the program should display an error message instead of prompting for the number of seconds.
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
STARTING OUT WITH C++ MPL
Additional Engineering Textbook Solutions
Problem Solving with C++ (10th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Starting Out with C++ from Control Structures to Objects (8th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Starting out with Visual C# (4th Edition)
- (Conversion) Blood pressure is the force of blood circulating against the inner wall of blood vessels. It’s measured by two numbers: a systolic number that measures the pressure when the heart is contracting and a diastolic number that measures the pressure when the heart is resting. Both pressures are typically measured in millimeters of mercury (mm Hg) and given assystolic/diastolic numbers, such as 122/88. The National Heart, Blood, and Lung Institute provides the following guidelines for normal and high blood pressure measurements. Complete the chart by converting the measurements to atm and psi units.arrow_forwardThe difference between two numbers is 15. If one number is represented by x, the other number can be expressed as whatarrow_forwardF3 R1 F2 R2 The wheel shown is free to rotate around a fixed axis which passes from its central point. Three strings are tied to the wheel and pulled, which results in the forces shown on the figure. The moment of inertia of the wheel is I. Data: 0.6 m, R1 = 0.3 m, F, R2 10 kg m2 F Find the angular acceleration a of the wheel along the indicated direction. 20.0 N 30.0 N, F3 10.0 N, rad/s? Checkarrow_forward
- A pendulum is simply a weight attached to a fixed point, usually through a string or a rod, and it swings freely backward and forward. The period of a pendulum is the amount of time that it takes to go from one point to another as it swings. Length of pendulum SWING T = PERIOD of the swing The formula to compute the period (7) is the following: T = 2π g=9.8 m/sec² L is the arm length of pendulum in meters. The unit of the period (7) is seconds. Write a program that will generate a table that will show the period (7) for several pendulums with lengths (L) in the range 10cm ≤L≤ 100cm in increments of 2cm. Your code must: 1) include a user-define function that performs a single period calculation, use the following function prototype: void pendulumPeriod(float length, float *period) 2) display to the monitor the length and period of the pendulums in table format with a header and units. 3) save the lengths and period of the pendulums to a file.arrow_forwardThe unit of convection current density is * O Ampere per Meter O Ampere O Volt per Meter O Ampere per Square Meterarrow_forwardNonearrow_forward
- Fix the codearrow_forwardThe total nuclear binding energy is the energy required to split a nucleus of an atom in its component parts: protons and neutrons, or, collectively, the nucleons. It describes how strongly nucleons are bound to each other. When a high amount of energy is needed to separate the nucleons, it means nucleus is very stable and the neutrons and protons are tightly bound to each other. The atomic number or proton number (symbol Z) is the number of protons found in the nucleus of an atom. The sum of the atomic number Z and the number of neutrons N gives the mass number A of an atom. Figure 1: Binding Energy in the Nucleus The approximate nuclear binding energy Eb in million electron volts, of an atomic nucleus with atomic number Z and mass number A is calculated using the following formula: See pictures The binding energy per nucleon (BEN) is calculated by dividing the binding energy (Eb) by the mass number (A). You are asked to write a program that requests the user for a valid atomic…arrow_forwardPrimary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 or 95) go north/south, and evens (like the 10 or 90) go east/west. Auxiliary highways are numbered 100-999 and service the primary highway indicated by the rightmost two digits. Thus, the 405 services the 5, and the 290 services the 90. Given a highway number, indicate whether it is a primary or auxiliary highway. If auxiliary, indicate what primary highway it serves. Also, indicate if the (primary) highway runs north/south or east/west. Ex: If the input is: 90 The output is: The 90 is primary, going east/west. Ex: If the input is: 290 The output is: The 290 is auxiliary, serving the 90, going east/west. Ex: If the input is: 0 Or any number not between 1 and 999, the output is: 0 is not a valid interstate highway number. import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int highwayNumber; int…arrow_forward
- Exercise 4 Take in one number and check if it is even or odd. Then, print out the number and tell me if it is even or odd. I # Take in one number and check if it is even or odd # print out the number and tell me if it is even or oddarrow_forwardZodiac Sign Capricorn Aquarius Pisces Aries Taurus Gemini Cancer Leo Virgo Libra Scorpio Sagittarius Date Range December 22 to January 19 January 20 to February 18 February 19 to March 20 March 21 to April 19 April 20 to May 20 May 21 to June 20 June 21 to July 22 July 23 to August 22 August 23 to September 22 September 23 to October 22 October 23 to November 21 November 22 to December 21 Write a program that asks the user to enter user's month and day of birth. Then your program should report the user's zodiac sign as part of an appropriate output message. You don't need to use loops if you use them use exit condition such a yes/no with an appropriate prompt. Make sure you test the program properly dates such a 0 or number greater that 31 should be classified as errors. Similarly, treat any month less than 1 and greater than 12 as error. The rest is simple, sample test case. Please enter your month of birth as a number: 2 Please enter your day of birth as a number: 12 You are a…arrow_forward18. Tom and Jerry opened a new lawn service. They provide three types of services: mowing, fertilizing, and planting trees. The cost of mowing is $35.00 per 5,000 square yards, fertilizing is $30.00 per application, and planting a tree is $50.00. Write an algorithm that prompts the user to enter the area of the lawn, the number of fertilizing applications, and the number of trees to be planted. The algorithm then determines the billing amount. (Assume that the user orders all three services.) (9)arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEnhanced Discovering Computers 2017 (Shelly Cashm...Computer ScienceISBN:9781305657458Author:Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. CampbellPublisher:Cengage Learning
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning