Yellow Belt

//Училище : Технологично училище “Електронни системи” към ТУ-София
//Клас: 11 Б
//Номер: 8
//Име: Виктор Георгиев Стоянов
//Задача: Да се намери сбора на първите 10 числа от .csv file

import java.io.*;
import java.util.*;
import java.lang.*;

class Yellow{
public static void main(String[] args){
float[] time = new float[10];
String fileName = args[0];
String line;
int i =0;
try{
BufferedReader reader = new BufferedReader(new FileReader(fileName));
while((line=reader.readLine())!=null){
time[i]=Float.parseFloat(line.split(“,”)[0]);
i++;
}
reader.close();
}catch(Exception e){

}
float timeSum = 0;
for(int j=0;j<10;j++){
timeSum += time[j];
}
try{
BufferedWriter writer = new BufferedWriter(new FileWriter(“TopTests.csv”));
writer.write(timeSum + “;\n”);
writer.close();
}catch(Exception e){

}
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s