Engineers often need to estimate the pressures and volumes of a gas in a container. The van
Question:
Engineers often need to estimate the pressures and volumes of a gas in a container. The van der Waals equation is often used for this purpose. It is
where the term b is a correction for the volume of the molecules and the term a/V̂2 is a correction for molecular attractions. The gas constant is R, the absolute temperature is T, and the gas specific volume is V̂. The value of R is the same for all gases; it is R = 0.08206 L-atm/mol-K. The values of a and b depend on the type of gas. Some values are given in the following table. Write a user-defined function using the switch structure that computes the pressure P on the basis of the van der Waals equation. The function’s input arguments should be T, V̂, and a string variable containing the name of a gas listed in the table. Test your function for chlorine (Cl2) for T = 300 K and V̂ = 20 L/mol.
Step by Step Answer: