import java.io.*; import java.text.*; //import java.util.*; public class SouborIO { static final int MAX_LENGTH = 100; private static String fileInPath="vstup.txt"; private static String fileOutPath="vystup.txt"; /*potreba prejmenovat tridu a metody, mozno dodelat osetreni chyb metody by mohly obsahovat jmeno souboru jako parametr*/ static void setInPath(String path){ fileInPath = path; } static void setOutPath(String path){ fileOutPath = path; } static String formatuj(double cislo, int cela, int desetinna) { String vzor = ""; while (vzor.length() != desetinna) { vzor += "0"; } vzor = "#." + vzor; DecimalFormatSymbols dfs = new DecimalFormatSymbols(); dfs.setDecimalSeparator('.'); DecimalFormat df = new DecimalFormat(vzor, dfs); String s = df.format(cislo); while (s.length() < (cela + desetinna + 1)) { s = " " + s; } return s; } /** *Vystup pole realnych cisel do souboru * *V poli musi byt na pozici 0 pocet cisel dale v poli */ public static void vystupDouble(double [] data){ String s; /*lze dodelat dalsi metody na jine datove typy*/ if (data.length<1 ){ System.err.println("Pole musi mit alespon jeden prvek."); return; } try { FileWriter fw = new FileWriter(fileOutPath); for (int i=0; i