Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- try {
- Scanner scan = new Scanner(new File("./input.txt"));
- double[][] measure = new double[3][4];
- String[] kind = new String[3];
- int x = 0, y = 0;
- while (scan.hasNextLine()) {
- for (String item : scan.nextLine().split(" ")) {
- try {
- measure[x][y] = Double.parseDouble(item);
- y++;
- } catch (Exception e) {
- kind[x] = item;
- }
- }
- y = 0;
- x++;
- }
- for (int i = 0; i < measure.length; i++) {
- for (int j = 0; j < measure[i].length; j++) {
- System.out.printf("%.1f ", measure[i][j]);
- }
- System.out.println(kind[i]);
- }
- } catch (Exception e) {
- System.out.println(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement