Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package projekt;
- import java.util.Scanner;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.PrintWriter;
- public class Projekt {
- public static void main(String[] args)throws FileNotFoundException{
- String opcja;
- Scanner odczyt = new Scanner(System.in);
- System.out.println("Podaj co chcesz zrobić");
- opcja = odczyt.nextLine();
- switch (opcja) {
- case "Dodawanie":
- String kkk;
- do{
- Scanner chej = new Scanner(System.in);
- System.out.println("Podaj książkę");
- kkk = chej.nextLine();
- try (PrintWriter zapis = new PrintWriter("imie.txt")) {
- zapis.println(kkk);
- }
- }while(kkk=="koniec");
- break;
- case "Usuwanie":
- System.out.println("Usuwanie");
- break;
- case "Sortowanie":
- System.out.println("Sortowanie");
- break;
- case "Wyszukiwanie":
- System.out.println("Wyszukiwanie");
- break;
- case "Wyświetlanie":
- File file = new File ("pla .txt");
- Scanner in = new Scanner(file);
- while(in.hasNext())
- {
- System.out.println(in.nextLine());
- }
- break;
- case "koniec":
- System.out.println("koniec");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement