Professional Documents
Culture Documents
import java.util.Scanner;
double Ex,Ey,Ex2,Exy;
double EX,EY,EX2,EXY;
System.out.println("A: Lineweaver-Burk");
System.out.println("B: Eadie-Hofstee");
String Equation=input.next();
switch (Equation)
{case "A":
System.out.println("Lineweaver-Burk");
double x1,x2,x3,x4,x5,y1,y2,y3,y4,y5;
x1=1/s1; y1=1/r1;
x2=1/s2; y2=1/r2;
x3=1/s3; y3=1/r3;
x4=1/s4; y4=1/r4;
x5=1/s5; y5=1/r5;
Ex=x1+x2+x3+x4+x5;
Ey=y1+y2+y3+y4+y5;
Ex2=Math.pow(x1,2)+Math.pow(x2,2)+Math.pow(x3,2)+Math.pow(x4,2)
+Math.pow(x5,2);
Exy=((x1*y1)+(x2*y2)+(x3*y3)+(x4*y4)+(x5*y5));
double m=((5*Exy)-(Ex*Ey))/((5*Ex2)-(Math.pow(Ex,2)));
double b=((Ey*Ex2)-(Ex*Exy))/((5*Ex2)-(Math.pow(Ex,2)));
double rmax=1/b;
double km=m*rmax;
System.out.printf("\nkm = %1.4f",km);
System.out.printf("\nrmax = %1.4f",rmax);
System.out.println(" ");
break;
case "B":
System.out.println("Eadie-Hofstee");
double X1,X2,X3,X4,X5,Y1,Y2,Y3,Y4,Y5;
X1=r1/s1; Y1=r1;
X2=r2/s2; Y2=r2;
X3=r3/s3; Y3=r3;
X4=r4/s4; Y4=r4;
X5=r5/s5; Y5=r5;
EX=X1+X2+X3+X4+X5;
EY=Y1+Y2+Y3+Y4+Y5;
EX2=Math.pow(X1,2)+Math.pow(X2,2)+Math.pow(X3,2)+Math.pow(X4,2)
+Math.pow(X5,2);
EXY=((X1*Y1)+(X2*Y2)+(X3*Y3)+(X4*Y4)+(X5*Y5));
double M=((5*EXY)-(EX*EY))/((5*EX2)-(Math.pow(EX,2)));
double B=((EY*EX2)-(EX*EXY))/((5*EX2)-(Math.pow(EX,2)));
System.out.printf("\nkm = %1.4f",-M);
System.out.printf("\nrmax = %1.4f",B);
System.out.println(" ");
break;
default:
System.out.println("Application Error!");