Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pr.wk02;
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.io.IOException;
- import java.util.*;
- public class number06 {
- public static void main(String[] args) throws IOException {
- BufferedReader reader;
- String strLine;
- List<String> list = new ArrayList<>();
- reader =
- new BufferedReader(
- new FileReader(
- "src/pr/wk02/testdata.txt"));
- while ((strLine = reader.readLine()) != null) {
- list.add(strLine);
- }
- String name = list.get(0);
- int exam1 = Integer.parseInt(list.get(1));
- int exam2 = Integer.parseInt(list.get(2));
- int exam3 = Integer.parseInt(list.get(3));
- System.out.println(name);
- double average;
- average = (exam1 + exam2 + exam3) / 3;
- System.out.printf("Average grade of " + name + " was " + "%1.2f", average);
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement