Concept explainers
Write a function and program to determine the mass of oxygen gas (formula O2, molecular weight = 32) in a container in units of grams. The function accepts input arguments representing the volume of the container in units of gallons, the temperature in the container in degrees Celsius, and the pressure in the container in units of atmospheres. The function output should be a single formatted string that contains the mass of the oxygen gas formatted to + decimal place followed by the units. For example the strings ‘10.0 grams’ or ‘13.3 grams’ would be samples of the expected output of your function. Note that this function should not generate any output on the screen. The program should prompt the user to input the volume in gallons, the temperature in degrees Celsius, and the pressure in atmospheres, and then call the function to create the formatted string containing the mass. Finally, your program should contain an output statement to display the mass of the oxygen gas in the container. For your test case, you may assume that the user provides 1.25 gallons for the volume of the container, 125 degrees Celsius for the temperature, and 2.5 atmospheres for the pressure in the container.
Sample Input/Output
Want to see the full answer?
Check out a sample textbook solutionChapter 18 Solutions
Thinking Like an Engineer: An Active Learning Approach (3rd Edition)
- Elements Of ElectromagneticsMechanical EngineeringISBN:9780190698614Author:Sadiku, Matthew N. O.Publisher:Oxford University PressMechanics of Materials (10th Edition)Mechanical EngineeringISBN:9780134319650Author:Russell C. HibbelerPublisher:PEARSONThermodynamics: An Engineering ApproachMechanical EngineeringISBN:9781259822674Author:Yunus A. Cengel Dr., Michael A. BolesPublisher:McGraw-Hill Education
- Control Systems EngineeringMechanical EngineeringISBN:9781118170519Author:Norman S. NisePublisher:WILEYMechanics of Materials (MindTap Course List)Mechanical EngineeringISBN:9781337093347Author:Barry J. Goodno, James M. GerePublisher:Cengage LearningEngineering Mechanics: StaticsMechanical EngineeringISBN:9781118807330Author:James L. Meriam, L. G. Kraige, J. N. BoltonPublisher:WILEY