import java.io.*;
import javax.swing.*;

class cubicTest1
{
 public static void main(String s[]) throws IOException
 {
   //Text cin=new Text();
   String gasname;
   //System.out.print("gasname = ");
   gasname=JOptionPane.showInputDialog("gasname = ");
   cubicEquationofState x=new cubicEquationofState(gasname,1,"Peng Robinson");
    System.out.println("equation of state name   = "+x.GasEquation);
   System.out.println("gas name   = "+x.Name);
   double T[]=new double[20];
   double P[]=new double[1000];
   double V[]=new double[1000];
    double tr[]={0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.2,1.4,1.6,1.8,2.0};
    int m=tr.length;
    int i=0;
    int n=1000;
    T[i]=x.Tc*tr[i];
    for(int j=0;j<n;j++)
    {V[j]=0.3/n*j+0.001;;
     P[j]=x.P(T[i],V[j]);
    }
    Plot pp=new Plot(V,P);
    for(i=1;i<m;i++)
      {T[i]=x.Tc*tr[i];
      for(int j=0;j<n;j++)
      {V[j]=0.3/n*j+0.001;
       P[j]=x.P(T[i],V[j]);
      }
    pp.addData(V,P); 
      }
   pp.plot();
 }
}
