import java.io.*;

class Gas2
{
double xa[],xb[],xc[],xd[],tl[],th[];
int n_equation;
int n_vis;
int n_k;
double xvis[];
double xk[];
int natom;
String gasName;
Atom atomList[];
double M;  // molar mass of atom kg/kmol
double h0; // enthalpy at T=298 K
double s0; // enthrophy at 298 K
double hf; // enthalpy of formation
double sf; // entropy of formation    kJ/kmol K
double N;  // moles of gas kmol
int ierror;
BufferedReader fin;
PrintWriter fout;
File gasDir;
// definations of class functions
// constructors
//===================================================================

//===================================================================

public Gas2() throws IOException
{
String s2="";
int i;
String aName;
double aN;
ierror=1;
N=1;
String tempGasName="";
       fout=new PrintWriter(new BufferedWriter(new FileWriter("Gas2.txt")));
       fin=new BufferedReader(new FileReader("Gas3.txt"));
       while(fin!=null)
       {
       s2="gasd=new GasData(";
       tempGasName=Text.readString(fin);
       gasName=tempGasName;
       s2+="\""+gasName+"\" ,\n";
       natom=Text.readInt(fin);
       s2+=natom+",\n";
       atomList=new Atom[natom];
       M=0;
       for(i=0;i<natom;i++)
          {
          aName=Text.readString(fin);
          aN=Text.readDouble(fin);
          s2+="\""+aName+"\", "+aN+",\n";
          atomList[i]=new Atom(aName,aN);
          M+=atomList[i].mass;
          }
      for(i=natom;i<5;i++)
          {  s2+="\""+"H"+"\", "+0.0+",\n";}
      n_equation=Text.readInt(fin);
      h0=Text.readDouble(fin);
      s0=Text.readDouble(fin);
      hf=Text.readDouble(fin);
      sf=Text.readDouble(fin);
      s2+=n_equation+", "+h0+", "+s0+", "+hf+", "+sf+",\n";
      xa=new double[n_equation];
      xb=new double[n_equation];
      xc=new double[n_equation];
      xd=new double[n_equation];
      tl=new double[n_equation];
      th=new double[n_equation];
      for(i=0;i<n_equation;i++)
          {
          xa[i]=Text.readDouble(fin);
          xb[i]=Text.readDouble(fin);
          xc[i]=Text.readDouble(fin);
          xd[i]=Text.readDouble(fin);
          tl[i]=Text.readDouble(fin);
          th[i]=Text.readDouble(fin);
          s2+=xa[i]+", "+xb[i]+", "+xc[i]+", "+xd[i]+", "+tl[i]+", "+th[i]+",\n";
          }
      for(i=n_equation;i<6;i++)
          { s2+="0.0,0.0,0.0,0.0,0.0,0.0,\n";}
      n_vis=Text.readInt(fin);
      s2+=n_vis+",\n";
      xvis=new double[n_vis];
      for(i=0;i<n_vis;i++)
          {
          xvis[i]=Text.readDouble(fin);
          s2+=xvis[i]+",";
          }
      s2+="\n";
      for(i=n_vis;i<10;i++)
          {s2+="0.0,";}
      n_k=Text.readInt(fin);
      s2+="\n"+n_k+",\n";
      xk=new double[n_k];
      for(i=0;i<n_k;i++)
         {
         xk[i]=Text.readDouble(fin);
         s2+=xk[i];
         if(n_k!=10) s2+=",";
         }
      s2+="\n";
      for(i=n_k;i<10;i++)
        {if(i!=9) s2+="0.0,";
         else s2+="0.0 );\n";}
         s2+="gi.addElement(gasd);\n";
        System.out.println(s2);
        fout.println(s2);
        }
        fout.close();
        fin.close();
}

//=================================================================
}

