Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Please roblem Description: The National Weather Service releases nearly a hundred weather balloons daily to monitor weather patterns in US and its territories. These
C++ Please
roblem Description: The National Weather Service releases nearly a hundred weather balloons daily to monitor weather patterns in US and its territories. These balloons drift as far as 125 miles and reach altitudes of nearly 40,000 meters. The balloons are made from neoprene and can be filled with either hydrogen or helium. Over the 48 hours period, the sun heats and cools the gases and cause the balloons to rise and fall. The altitude of a weather balloon as a function of time flight is modeled by the following polynomial equation: altitude(t)=CAt4+CBt3+CCt2+CDt+CE The time t is measured in hours. For both gasses (hydrogen or helium): - CA=0.12 - CD=4100.0 - CE=220.0 For hydrogen: - CB=12.0 - CC=380.0 For helium: - CE=12.2 - Cc=380.5 Using this model, the altitude of a weather balloon using each of the gases is shown below. As you can see, throughout the 48-hour period, balloons with either gas have two peak altitudes and one valley altitude (i.e. low point) between these two peaks. However, for the two gasses, the height of these peaks and valley, and the time that they occur, are different. Code Design Specifications: Design, code and test a procedural C++program, the calculates the value for, and time of occurrence, of the two peaks and one valley altitudes for a weather balloon given the gas it is filled with. - The program has one string input, "hydrogen" or "helium". These inputs are not case sensitive, so "hydrogen", "HYDROGEN", "Hydrogen", or "HyDroGeN" are all legal inputs. - Based on the gas type entered, the program should loop from time =0 to time =48 in 0.01-hour increments to locate the value of the two peak altitudes and the times when they occurred. - Using the values of time from the previous step, the program should loop from the time of the first peak to the time of the second peak in 0.01-hour increments to locate the value, and time of, the valley altitude. - The coefficients CA,CB,CC,CD, and CE should be stored as C++ numeric constants. - When finished, the program produces an output displaying the altitudes and times for the two peaks and one valley: - If an illegal string is entered, the program should display an error message and terminate. - If an illegal string is entered, the program should display an error message and terminate. - Example: lnptT Your output ERROR... Illegal Gas Type - Note: all output values should be displayed with two decimal points of accuracy (i.e. precision). - The program must utilize two user defined functions, HydrogenAltitude () and HeliumAltitude ( ). Each function accepts a single parameter for time and returns the corresponding altitude. These functions should be called by main()Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started