(20) A particularly simple abstraction of a gas views the gas as a material with a pressure dcpendent volume. In this abstrac

program using C++ and DISLIN, please leave comments thanks!

(20) A particularly simple abstraction of a gas views the gas as a material with a pressure dcpendent volume. In this abstraction, the actual chemical composition of the gas is unimportant as only its physical peoperties are of practical interest. Develop a class that implements a physical abstraction of a gas in which the only relevant properties are its Van der Waals constants a and b and the problem is to number of moles, . The relationship betwoen these guantities is given bv the Van der Waals equation of state (P – bn)- nRT e Van der Waals constants are a 0.027 P. atm/mol2 and b For oxygen gas, t 0.0024 L/mol, while the gas constant R 0.0821 atm/(mol K). For these values, use your program to graph the dependence of pressure on volume for n= I mole of gas for volumes from 1 to 10 liters. Use 100 points in your graph. Hand in your program and the graph Your program should take e following form #include conet double R-0.002 elase Gas publie double iA double iB Gaa(double a, double aB) class VanDerwaalecaleulator publi Gas iGas: float iVolume [1001 a tlost float iumberofMoles; int iunberofPoints vanDerWaalCalculator Gas aGas, double atinimunVolume, double ataximunVolume, double aTemperature, double aNunberotNoles, int aunberof Points) / Use the Van der Waals formula to generate the pressure I vector void generatePressure () Graph function of volume. anure as void draw) main) Gas oxygen(0.027, 0.0014) ine numberofPoints 100 float maximumvolume 10 Eloat temperature 300 VanDerHaalaCalculator VDw(Orygen, minimumVolume, maimumVolune, temperature, numberotMoles, numberofPoints) VDw.dravts ressure() The class VanDerWalls Calculator can if desired contain two additional intenal variables, namely iMinimumVolume and iMaximumVolume (or you can simply IGas in the initialization list not the body of the constauctor of VanDerWallsCalculator unless you also supply a default (zero) argument constructor for the class Gas. Remember to employ double in place of float below assuming that you installed tthe double precision version of DISLIN.

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *