import java.util.StringTokenizer;
class TestFile
{
public static void main(String args[])
{
String inFile;
String outFile;
String a,c;
Double b,i=0.0;int k;
try
{
inFile=args[0];
FileReader rdinFile = new FileReader(inFile);
BufferedReader brdinFile = new BufferedReader(rdinFile);
for(k=1;k<12;k++)
{
a=brdinFile.readLine();
b=Double.parseDouble(a);
i=i+b;
}
System.out.println(i);
inFile=args[0];
StringTokenizer tokens = new StringTokenizer(inFile, ".t");
outFile=tokens.nextToken() + ".w" + tokens.nextToken();
System.out.println(outFile);
File myfile=new File(outFile);
myfile.createNewFile();
FileWriter fos= new FileWriter(outFile);
BufferedWriter bfos=new BufferedWriter(fos);
i=i/11;
c=String.valueOf(i);
bfos.write(c);
bfos.flush();
bfos.close();
}
catch (Exception e)
{
System.out.println("exception");
}
}
}
沒有留言:
張貼留言