Answered step by step
Verified Expert Solution
Question
1 Approved Answer
!!!!!!!Can you use C programing!!!!!!!! The pressure of a gas changes as the volume and temperature of the gas vary. Write a program that uses
!!!!!!!Can you use C programing!!!!!!!!
The pressure of a gas changes as the volume and temperature of the gas vary. Write a program that uses the Van der Waals equation of state for gas, P*V=N*R*T You need to display in tabular form the relationship between the pressure and the volume of n moles gas at a constant temperature (T), P is the pressure and V is the volume. Use 8.3145 for gas constant R. Your program will output a table that varies the volume of the gas from the initial to the final volume in steps prescribed by the volume increment. Your program should ask the user to continue or stop. To continue user must enter y', to stop 'n' letter. If the user enters different letter from 'y' or 'n' the program should continue to ask again as in sample run. Assume that user can enter one letter. Attention: **You have to solve the problem using what we have covered in the class so far. For example, you CAN NOT USE any standard library functions or operations such as strings in the solution which we did not teach you! **The output format must be the same format as the sample runs below! Here is some sample run: * Here User starts to enter some specification of the gas Sample Run 1: Enter the name of gas: H Quantity of H (moles): 1.2 Temperature (kelvin): 356 Initial volume (milliliters): 400 Final volume (milliliters): 600 Volume increment (milliliters): 50 1.200 moles of H at 356 kelvin * Here program starts the outputs the values* Volume (ml) Pressure (atm) 400 450 500 550 600 8.8799 7.8932 7.1039 6.4581 3.9199 * Here program asks the user to continue or not. The user entered n so the program is terminated with bye message Do you want to continue (y): n Bye. Sample Run 2: Enter the name of gas: N Quantity of N (moles): 0.2 Temperature (kelvin): 300 Initial volume (milliliters): 245 Final volume (milliliters): 300 Volume increment (milliliters): 17 0.200 moles of N at 300 kelvin Volume (ml) Pressure (atm) 245 262 279 296 2.0362 1.9041 1.7881 1.6854 * Here if the user entered any letter except y and n. The program should ask till the correct letter entered. Do you want to continue (y ): e You entered wrong character Do you want to continue (y ): t You entered wrong character Do you want to continue (y ): n Bye. Sample Run 3: Enter the name of gas: 0 Quantity of O moles): 2.3 Temperature (kelvin): 100 Initial volume (milliliters): 200 Final volume (milliliters): 300 Volume increment (milliliters): 50 2.300 moles of O at 100 kelvin Volume (ml) Pressure (atm) 200 9.5617 250 7.6493 300 6.3744 Do you want to continue (y): y Here if the user enters 'y' letter. The program should ask the specification of the new gas. After some computing it displays its values again. Enter the name of gas: F Quantity of F (moles): 3.4 Temperature (kelvin): 245 Initial volume (milliliters): 300 Final volume (milliliters): 500 Volume increment (milliliters): 15 3.400 moles of F at 245 kelvin Volume (ml) Pressure (atm) 300 315 330 345 360 375 390 405 420 435 450 465 480 495 23.0866 21.9872 20.9878 20.0753 19.2388 18.4693 17.7589 17.1012 16.4904 15.9218 15.3911 14.8946 14.4291 13.9919 Do you want to continue (y): n ByeStep 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