Advertisement
Guest User

najnowwsze

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