N2 ClassAs we saw with the PerfectGas class, writing a specific gas species subclass of the Species class is a simple and straightforward effort. All the subclass will do is load the data for a given gas species and call the Species constructor. All other functionality the subclass needs it inherits from the Species class. We will define two Species subclasses. The first, N2 , represents diatomic nitrogen. The a[][] array contains the Lewis coefficient data used to compute the species' specific heat, enthalpy, and entropy. Here is the source code for the N2 class. package TechJava.Gas; public class N2 extends Species { // Fill the Lewis curve fit coefficient // array with data for N2 private static double a[][] = { { 2.21037122e+04, 5.87709908e+05, 8.30971200e+08}, {-3.81846145e+02,-2.23924255e+03,-6.42048187e+05}, { 6.08273815e+00, 6.06694267e+00, 2.02020507e+02}, {-8.53091381e-03,-6.13965296e-04,-3.06501961e-02}, { 1.38464610e-05, 1.49179819e-07, 2.48685558e-06}, {-9.62579293e-09,-1.92309442e-11,-9.70579208e-11}, { 2.51970560e-12, 1.06194871e-15, 1.43751673e-15}, { 7.10845911e+02, 1.28320618e+04, 4.93850663e+06}, {-1.07600320e+01,-1.58663484e+01,-1.67204791e+03} }; // The N2 constructor calls the Species constructor // with the appropriate data for N2 public N2() { super("N2", 0.0280134, a); } } |