Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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 line

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

=+Are the contracts enforceable?

Answered: 1 week ago