-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwokolad_name.java
More file actions
86 lines (76 loc) · 2.31 KB
/
wokolad_name.java
File metadata and controls
86 lines (76 loc) · 2.31 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import java.io.*;
import java.util.Scanner;
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);
}
public void first (String a)
{
try
{
BufferedReader reader = new BufferedReader(new FileReader("Wokolad_info.txt"));
String line = reader.readLine();
while(line != null)
{
if(line.equals(a))
{
// do something
for (int i = 0; i < 8; i++)
{
System.out.println(line);
line=reader.readLine();
}
}
line=reader.readLine();
}
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
}
}
}