-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwokolad_name.java
More file actions
56 lines (50 loc) · 1.56 KB
/
wokolad_name.java
File metadata and controls
56 lines (50 loc) · 1.56 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import java.io.*;
public class wokolad_name
{
public static void main(String[] args)
{
Show_full_info("Wokolad_info.txt");
}
public static long numOfLines(String fileName)
{
//Hell nahhh
//come on
long lines = 0;
try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
while (reader.readLine() != null) lines++;
} catch (IOException e) {
e.printStackTrace();
}
return lines/8;
}
public static void Show_info(String filename)
{
try {
FileReader reader = new FileReader(filename);
int data = reader.read();
while(data != -1) {
System.out.print((char)data);
data = reader.read();
}
reader.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void Show_full_info(String filename)
{
long num = numOfLines(filename);
System.out.println("Total number of wokolad types: " + num);
Show_info(filename);
}
public static void Sale(String sale_name) throws IOException
{
FileWriter fw = new FileWriter("Wokolad_info.txt", true);
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter pw = new PrintWriter(bw);
}
}