Created
September 20, 2017 19:03
-
-
Save Florian3k/5bb9a446a0f1db5551ef7116f5cfddfa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
import java.io.PrintWriter; | |
public class HelloWorld { | |
private static Scanner s; | |
public static void main(String[] args){ | |
System.out.println(Bownik() + Chuj()); | |
s = new Scanner(System.in); | |
try { | |
System.out.print("Podaj liczbę ciągów: "); | |
int series = s.nextShort(); | |
System.out.print("Podaj liczbę wyrazów ciągu: "); | |
int amount = s.nextShort(); | |
s.nextLine(); | |
System.out.print("Podaj ścieżkę dostępu: "); | |
String path = s.nextLine(); | |
System.out.print("Podaj nazwę pliku: "); | |
String fname = s.nextLine(); | |
WriteToFile(series, amount, path + fname + ".csv"); | |
} catch(Exception e) { | |
System.out.println("Ty kurwo naucz się podawać liczby"); | |
System.exit(1); | |
} | |
} | |
public static String Bownik(){ | |
return "Bownik"; | |
} | |
public static String Chuj(){ | |
return " to chuj"; | |
} | |
public static void WriteToFile(int series, int amount, String fpath) { | |
try{ | |
PrintWriter writer = new PrintWriter(fpath , "UTF-8"); | |
for (int i = 1; i <= series; i++) { | |
int num = 1; | |
for (int j = 1; j <= amount; j++) { | |
num *= i; | |
writer.print(num); | |
if (j < amount){ | |
writer.print(","); | |
} else { | |
writer.println(""); | |
} | |
} | |
} | |
writer.close(); | |
} catch (Exception e) { | |
System.out.println(e); | |
System.out.println("chuj a nie plik"); | |
System.exit(1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment