Skip to content

Instantly share code, notes, and snippets.

@takuma7
Created December 16, 2011 02:28
Show Gist options
  • Save takuma7/1484149 to your computer and use it in GitHub Desktop.
Save takuma7/1484149 to your computer and use it in GitHub Desktop.
import java.io.*;
class Mondai18_1{
public static void main(String[] args){
String inputFileName = args[0];
try{
BufferedReader r = new BufferedReader(new FileReader(inputFileName));
String line;
int sum=0;
while((line=r.readLine())!=null){
String[] in = line.split(" ");
String name = in[0];
int val = Integer.parseInt(in[1]);
sum+=val;
System.out.println(name + " branch\t" + val);
}
System.out.println("sales sum : " + sum + " thousands yen");
r.close();
}catch(Exception e){
System.out.println(e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment