Advertisement
Guest User

prodżekt

a guest
Jan 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.67 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.                 while(kkk.equals("koniec")){
  18.                 if(kkk.equals("koniec")){
  19.                    
  20.                 }
  21.                 else{
  22.                Scanner chej = new Scanner(System.in);
  23.                 System.out.println("Podaj książkę");
  24.                  kkk= chej.nextLine();
  25.                  try (PrintWriter zapis = new PrintWriter("imie.txt")) {
  26.             zapis.println(kkk);
  27.            }
  28.                 }
  29.                 }
  30.        
  31.                
  32.                    
  33.             break;
  34.             case "Usuwanie":
  35.                 System.out.println("Usuwanie");
  36.             break;
  37.             case "Sortowanie":
  38.                 System.out.println("Sortowanie");
  39.             break;
  40.             case "Wyszukiwanie":
  41.                 System.out.println("Wyszukiwanie");
  42.             break;
  43.             case "Wyświetlanie":
  44.                 File file = new File ("pla .txt");
  45.         Scanner in = new Scanner(file);
  46.       while(in.hasNext())
  47.       {
  48.         System.out.println(in.nextLine());
  49.       }
  50.        
  51.             break;
  52.             case "koniec":
  53.                 System.out.println("koniec");
  54.             break;
  55.         }  
  56.        
  57.     }
  58.    
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement