Last active
April 17, 2023 17:15
Revisions
-
songyang-dev revised this gist
Apr 17, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,8 @@ public class IdealGasConstant { private static IdealGasConstant _instance = new IdealGasConstant(); private IdealGasConstant() { this.litersAtmospherePerKelvinPerMole = 0.082057366080960; this.metersCubedPascalPerKelvinPerMole = 8.31446261815324; } public static IdealGasConstant getInstance() { -
songyang-dev revised this gist
Apr 17, 2023 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,10 +4,9 @@ public class IdealGasConstant { public double metersCubedPascalPerKelvinPerMole; //m3⋅Pa⋅K−1⋅mol−1 private static IdealGasConstant _instance = new IdealGasConstant(); private IdealGasConstant() { _instance.litersAtmospherePerKelvinPerMole = 0.082057366080960; _instance.metersCubedPascalPerKelvinPerMole = 8.31446261815324; } -
songyang-dev created this gist
Apr 17, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ class Acceleration { public double metersPerSecondSquared; public double kilometersPerSecondSquared; public double newtonsPerKilogram; public Acceleration(double metersPerSecondSquared) { this.metersPerSecondSquared = metersPerSecondSquared; this.kilometersPerSecondSquared = metersPerSecondSquared / 1000; this.newtonsPerKilogram = metersPerSecondSquared; } public static void main(String[] args) { Acceleration accelerationEarth = new Acceleration(9.8); double timeSeconds = 10.0; double distanceMeters = accelerationEarth.metersPerSecondSquared * timeSeconds * timeSeconds; } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ public class GravityConstants { public static final Acceleration EARTH = new Acceleration(9.8); public static final Acceleration MOON = new Acceleration(1.6); public static final Acceleration SUN = new Acceleration(275); public static void main(String[] args) { // F = m g double massBallKilogram = 1.0; var earthGravityNewtons = massBallKilogram * GravityConstants.EARTH.newtonsPerKilogram; } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ public class IdealGasConstant { public double litersAtmospherePerKelvinPerMole; // L⋅atm⋅K−1⋅mol−1 public double metersCubedPascalPerKelvinPerMole; //m3⋅Pa⋅K−1⋅mol−1 private static IdealGasConstant _instance; private IdealGasConstant() { _instance = new IdealGasConstant(); _instance.litersAtmospherePerKelvinPerMole = 0.082057366080960; _instance.metersCubedPascalPerKelvinPerMole = 8.31446261815324; } public static IdealGasConstant getInstance() { return _instance; } public static void main(String[] args) { IdealGasConstant idealGasConstant = IdealGasConstant.getInstance(); // P V = n R T double numberOfParticlesMole = 1; double temperatureKelvin = 273; double pressurePascal = 100; double volumeMetersCubed = numberOfParticlesMole * idealGasConstant.metersCubedPascalPerKelvinPerMole * temperatureKelvin / pressurePascal; } }