2010年6月11日 星期五

import java.io.*;
import java.util.*;
public class Test
{
/**
* @param args

*/

public static void main(String[] args)
{

// TODO 自動產生方法 Stub

Myprint1 myprint = new Myprint1();

mprint.mytest();
}
}

class Myprint
{

Myprint()
{
}

void mytest()
{
String inputs = "";
try
{
FileReader myinpufile = new FileReader("940305.SM");
BufferedReader isr = new BufferedReader(myinpufile);

//System.out.println(isr.readLine());
FileWriter myoutfile = new FileWriter("940305w.SM");
BufferedWriter isrw = new BufferedWriter(myoutfile);
int[][] a = new int[2][2];
int[][] b = new int[2][2];
int[][] c = new int[2][2];

for (int i = 1; i <= 1; i++)
{
inputs = isr.readLine();
System.out.println(inputs);
StringTokenizer mytoken = new StringTokenizer(inputs, ",");
a[0][0] = Integer.parseInt(mytoken.nextToken());
a[0][1] = Integer.parseInt(mytoken.nextToken());
//System.out.println(a[0][0]);
//System.out.println(a[0][1]);

inputs = isr.readLine();
System.out.println(inputs);
StringTokenizer mytoken2 = new StringTokenizer(inputs, ",");
a[1][0] = Integer.parseInt(mytoken2.nextToken());
a[1][1] = Integer.parseInt(mytoken2.nextToken());
//System.out.println(a[1][0]);
//System.out.println(a[1][1]);

inputs = isr.readLine();
System.out.println(inputs);
StringTokenizer mytoken3 = new StringTokenizer(inputs, ",");
b[0][0] = Integer.parseInt(mytoken3.nextToken());
b[0][1] = Integer.parseInt(mytoken3.nextToken());
//System.out.println(b[0][0]);
//System.out.println(b[0][1]);

inputs = isr.readLine();
System.out.println(inputs);
StringTokenizer mytoken4 = new StringTokenizer(inputs, ",");
b[1][0] = Integer.parseInt(mytoken4.nextToken());
b[1][1] = Integer.parseInt(mytoken4.nextToken());
//System.out.println(b[1][0]);
//System.out.println(b[1][1]);

c[0][0] = a[0][0] + b[0][0];
c[1][0] = a[1][0] + b[1][0];
c[0][1] = a[0][1] + b[0][1];
c[1][1] = a[1][1] + b[1][1];

System.out.println("\n[" + c[0][0] + " " + c[0][1] + "]");
System.out.println("\n[" + c[1][0] + " " + c[1][1] + "]");

isrw.write("\n[" + c[0][0] + " " + c[0][1] + "]");
isrw.write("\n[" + c[1][0] + " " + c[1][1] + "]");

}
isrw.flush();
myoutfile.close();
}
catch (Exception e)
{ }


System.out.println("Hello");

}

}

class Myprint1 extends Myprint

{

}

沒有留言:

張貼留言