-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main2.java
40 lines (31 loc) · 901 Bytes
/
Main2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Main2 {
public static void main(String[] args) throws IOException {
String nome = "Notas1.txt";
FileReader arquivo = new FileReader(nome);
BufferedReader ler = new BufferedReader(arquivo);
System.out.println("Iniciando a leitura do arquivo...");
String linha = ler.readLine();
// System.out.println(linha);
// ler.lines().forEach(System.out::println);
int qnt = 0;
double soma = 0;
double media = 0;
String[] pedacos = null;
while (linha != null) {
pedacos = linha.split(";");
for (String x : pedacos) {
Double valores = Double.parseDouble(x);
soma += valores;
System.out.println(soma);
System.out.println(valores);
System.out.println(" ");
qnt++;
}
ler.readLine();
}
ler.close();
}
}