Question
Java - develop a program that calculates the pressure of a system using the Ideal Gas Law. This is the code I have now: In
Java - develop a program that calculates the pressure of a system using the Ideal Gas Law.
This is the code I have now:
In the homework specifications, I need to set a constant for the ideal gas law, being (8.314 J/mol*K). I am so confused on how to set this up. I am using JOptionPane to ask the user for value which is then converted to a double and placed in my table. The only values I can ask for is mols, temperature, and volume. I've been stuck on this forever and would really appreciate help on this.
All I need is to setup the calculations and create a variable that stores the pressure inside it, based on the variables molsDouble, temperatureDouble, and volumeDouble. Thanks so much!
// declare variables String chosenMols; String chosenTemp; String chosenvol; int blockSize; int numChars; int numPrecision; double molsDouble; double temperatureDouble; double volumeDouble; //final double idealGasLaw = (molsDouble * ); final double numerator = double endPressureDouble = 0; (8.314); // get input from user chosenMols = J0ptionPane.showInputDialog("Enter number of mols"); chosenTemp = J0ptionPane.showInputDialog("Enter temperature (K)"); chosenVol = JOptionPane.showInputDialog("Enter volume (N/m^2)"); // translate to double values molsDouble = Double.parseDouble(chosenMols); temperatureDouble volumeDouble - Double.parseDouble(chosenTemp); Double.parseDouble(chosenVol); // calculate results // find numerator // find pressure // display results // Display top/title lineStep 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