CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 15:26:01 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=f68c97132652a1e8077a1ac8928ef5ebf370011e37a7059620e521316ce734aba%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22hqGj2_vqSuM3bGTkJAkdcrEXF4IQtU93%22%3B%7D; HttpOnly; Path=/
cf-ray: 98cf5f9a6e25e084-BLR
Prog 13.12. - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ještě je potřeba třída Student s atributy String name, String address, LocalDate bithDate a soubor students.csv s informacemi zapsanými takto: "jméno; adresa; datum;"
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.io.IOException;
- import java.time.LocalDate;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- // Seznam žáků
- List<Student> students = new ArrayList<>();
- // Načtení souboru CSV
- try (BufferedReader reader = new BufferedReader(new FileReader("students.csv"))) {
- // Přeskočení hlavičky souboru
- reader.readLine();
- // Načtení řádků souboru
- String line;
- while ((line = reader.readLine()) != null) {
- // Rozdělení řádku na jednotlivé sloupce
- String[] columns = line.split(";");
- // Získání jména, bydliště a datumu narození ze sloupců
- String name = columns[0].trim();
- String address = columns[1].trim();
- String birthDate = columns[2].trim();
- // Vytvoření nového žáka a přidání do seznamu
- Student student = new Student(name, address, LocalDate.of(2004, 10, 10));
- students.add(student);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- // Získání filtra zadaného uživatelem
- Scanner scanner = new Scanner(System.in);
- System.out.println("Zadejte filtr pro vyhledávání žáků:");
- String filter = scanner.nextLine().trim();
- // Filtr
- List<Student> filteredStudents = new ArrayList<>();
- for (Student student : students) {
- if (student.getName().contains(filter) || student.getAddress().contains(filter)) {
- filteredStudents.add(student);
- }
- }
- // Výpis žáků, kteří odpovídají filtru
- for (Student student : filteredStudents) {
- System.out.println(student.getName() + ": " + student.getAddress());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
✅⭐ Make huge profits on trading ✅ NEVER SEEN...
JavaScript | 2 sec ago | 0.24 KB
-
⭐✅ MAKE $2500 IN 15 MIN⭐⭐⭐ 6
JavaScript | 8 sec ago | 0.24 KB
-
⭐⭐⭐GMAIL Logs (2FA disabled)⭐⭐
Java | 10 sec ago | 0.10 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 12 sec ago | 0.24 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ E
JavaScript | 19 sec ago | 0.24 KB
-
✅⭐ Make $2500 in 15 minutes ✅ NEVER SEEN BEFO...
JavaScript | 21 sec ago | 0.24 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ M
JavaScript | 30 sec ago | 0.24 KB
-
⭐✅ Trading Profit Method ✅ NEVER SEEN BEFORE...
JavaScript | 40 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand