Advertisement
Guest User

projektkropiszka

a guest
Jan 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.54 KB | None | 0 0
  1. package projekt;
  2. import java.util.Scanner;
  3. import java.io.File;
  4. import java.io.FileNotFoundException;
  5. import java.io.PrintWriter;
  6.  
  7. public class Projekt {
  8.     public static void main(String[] args)throws FileNotFoundException{
  9.        String opcja;
  10.        Scanner odczyt =  new Scanner(System.in);
  11.        System.out.println("Podaj co chcesz zrobić");
  12.        opcja = odczyt.nextLine();
  13.        
  14.         switch (opcja) {
  15.             case "Dodawanie":
  16.                 String kkk;
  17.                
  18.                do{
  19.                Scanner chej = new Scanner(System.in);
  20.                 System.out.println("Podaj książkę");
  21.                 kkk = chej.nextLine();
  22.                
  23.            try (PrintWriter zapis = new PrintWriter("imie.txt")) {
  24.             zapis.println(kkk);
  25.         }
  26.                }while(kkk=="koniec");
  27.                    
  28.             break;
  29.             case "Usuwanie":
  30.                 System.out.println("Usuwanie");
  31.             break;
  32.             case "Sortowanie":
  33.                 System.out.println("Sortowanie");
  34.             break;
  35.             case "Wyszukiwanie":
  36.                 System.out.println("Wyszukiwanie");
  37.             break;
  38.             case "Wyświetlanie":
  39.                 File file = new File ("pla .txt");
  40.         Scanner in = new Scanner(file);
  41.       while(in.hasNext())
  42.       {
  43.         System.out.println(in.nextLine());
  44.       }
  45.        
  46.             break;
  47.             case "koniec":
  48.                 System.out.println("koniec");
  49.             break;
  50.         }  
  51.        
  52.     }
  53.    
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement