package projektas;
import java.util.Scanner;
import java.io.File;
import java.io.*;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Projektas {
public static void main(String[] args)throws IOException{
String opcja;
System.out.println("Witaj w programie bibliotecznym. AUTORZY KROPISZ I KRZYK");
Map<Integer, String> ksiazki = new HashMap<Integer, String>();
for(;;){
Scanner odczyt = new Scanner(System.in);
System.out.println("\n\nMasz do wyboru: \nDodawanie/Usuwanie/Wyszukiwanie/Wyswietl");
System.out.println("\tNapisz co chcesz wykonać: ");
opcja = odczyt.nextLine();
String tytul;
int numer = 0;
switch (opcja) {
case "Dodawanie":
String koniec;
do{
System.out.println("Podaj nr ewidencyjny książki ");
Scanner nr = new Scanner(System.in);
numer = nr.nextInt();
System.out.println("Podaj książkę oraz jego autora");
Scanner dod = new Scanner(System.in);
tytul = dod.nextLine();
ksiazki.put(numer, tytul);
System.out.println("Czy to wszystko? tak/nie");
Scanner all = new Scanner(System.in);
koniec = all.nextLine();
System.out.println(ksiazki);
}while(!koniec.equals("tak"));
break;
case "Usuwanie":
int usuwanie;
do{
System.out.println("Podaj numer ewidencyjny książki którą chcesz usunąć:");
Scanner us = new Scanner(System.in);
usuwanie = us.nextInt();
ksiazki.remove(usuwanie);
System.out.println(ksiazki);
System.out.println("Czy to wszystko? tak/nie");
Scanner all = new Scanner(System.in);
koniec = all.nextLine();
System.out.println(ksiazki);
}while(!koniec.equals("tak"));
break;
case "Wyszukiwanie":
int Wyszukiwanie;
do{
System.out.println("Podaj nr ewidencyjny");
Scanner wysz = new Scanner(System.in);
Wyszukiwanie = wysz.nextInt();
String s1 = ksiazki.get(Wyszukiwanie);
//if (Wyszukiwanie==numer){
if(s1 != null){
System.out.println("Tytuł oraz autor podanej książki to: "+ s1);
}else{
System.out.println("Nie ma takiej książki w bazie");
}
System.out.println("Czy to wszystko? tak/nie");
Scanner all = new Scanner(System.in);
koniec = all.nextLine();
}while(!koniec.equals("tak"));
break;
case "Wyswietl":
System.out.println(ksiazki);
break;
}
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}