Write a C++ program called “HW3c.cpp” that will solve the following problem:

The pressure of a gas changes as the volume and temperature of the gas vary. We are all familiar with the ideal gas equation of state which relates pressure, specific volume and temperature (Pv = RT) where P is the pressure, v is the specific volume, R is the gas constant and T is the absolute temperature. There are many other equations of state used to describe the relationship between P, v and T. Another common one is the Van der Waals equation of state given as:


where:
P = Pressure (atm) atm = atmospheres
V = Volume (L)
T = Temperature (K)
R = Gas Constant = 0.08206 (L atm) / (mol K) for Carbon Dioxide
a = 3.592 L2 atm / mol2 for Carbon Dioxide
b = 0.0427 L / mol for Carbon Dioxide
n = number of mole (mol)

Write a program that will use the Van der Waals equation of state to display in tabular form the relationship between pressure, volume and temperature for carbon dioxide. Inputs to the program include n, the temperature in K, and the initial and final volumes in milliliters and the volume increment between lines of the table. Your program will display a table that varies the volume of the gas from the initial to final volume in steps prescribed by the volume increment. A sample run should look like this:

***********************************************************************
Please enter at the prompts the number of moles of carbon dioxide, the absolute temperature, the initial volume in milliliters, the final volume in milliliters, and the increment volume between lines in the table.
************************************************************************
Quantity of carbon dioxide (moles) > 0.02
Temperature (K) > 300
Initial Volume (milliliters) > 400
Final Volume (milliliters) > 600
Volume increment (milliliters) > 50

0.02 moles of carbon dioxide at 300 Kelvin

Volume (mL) Pressure (atm)

400 1.2246
450 1.0891
500 0.9807
550 0.8918
600 0.8178

if anyone can get this done by tomorrow... i'd send a thank you via paypal?

Recommended Answers

All 3 Replies

Daniweb isn't a homework service.

yea, i know that. i'm just totally screwed and need a little help with this one. sorry.

Well, you're still screwed because if you want help here, you still need to do the work yourself. We'll help, but we won't do it for you. If you want someone to do it for you, go somewhere like rentacoder.com and hire cheap labor.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.