import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { //deklaracja wszystkich zmiennych Scanner scanner = new Scanner(System.in); String singleChoice; boolean correctInput = false; boolean pozaGranice = false; boolean niskieKoszty = false; boolean iloscLadunku = false; boolean szybkosc = false; String rodzajLadunku = ""; //pierwszy wybor System.out.println("Czy chcesz przewiezc ladunek poza granice kraju? (Tak)/(Nie)"); //jesli tak, to wybor jest umieszczany hashmapie jako 1, // czyli dla klucza o wartosci w tym przypadku 0 przypisywanie jest 1. //Analogicznie dla przypadku kiedy wybor jest nie while(correctInput == false) { singleChoice = scanner.next(); if (singleChoice.equals("Tak")) { pozaGranice = true; correctInput = true; } else if (singleChoice.equals("Nie")) { pozaGranice = false; correctInput = true; } if(correctInput == false) { System.out.println("Niepoprawnie wpisana odpowiedz, sproboj ponownie"); } } //resetowanie zmiennej idioto-odpornej, analogicznie dalej correctInput = false; System.out.println("Czy zalezy Ci na niskich kosztach? (Tak)/(Nie)"); while(correctInput == false) { singleChoice = scanner.next(); if (singleChoice.equals("Tak")) { niskieKoszty = true; correctInput = true; } else if (singleChoice.equals("Nie")) { niskieKoszty = false; correctInput = true; } if(correctInput == false) { System.out.println("Niepoprawnie wpisana odpowiedz, sproboj ponownie"); } } correctInput = false; System.out.println("Czy chcesz przewiezc mala ilosc ladunku? (Tak)/(Nie)"); while(correctInput == false) { singleChoice = scanner.next(); if (singleChoice.equals("Tak")) { iloscLadunku = true; correctInput = true; } else if (singleChoice.equals("Nie")) { iloscLadunku = false; correctInput = true; } if(correctInput == false) { System.out.println("Niepoprawnie wpisana odpowiedz, sproboj ponownie"); } } correctInput = false; System.out.println("Czy zalezy Ci na szybkosci? (Tak)/(Nie)"); while(correctInput == false) { singleChoice = scanner.next(); if (singleChoice.equals("Tak")) { szybkosc = true; correctInput = true; } else if (singleChoice.equals("Nie")) { szybkosc = false; correctInput = true; } if(correctInput == false) { System.out.println("Niepoprawnie wpisana odpowiedz, sproboj ponownie"); } } correctInput = false; System.out.println("Wybierz rodzaj ładunku:"); System.out.println("Ponadgabarytowy (P),"); System.out.println("Niebiezpieczny (ADR),"); System.out.println("Normalny (N)"); while(correctInput == false) { singleChoice = scanner.next(); if (singleChoice.equals("P")) { rodzajLadunku = "P"; correctInput = true; } else if (singleChoice.equals("ADR")) { rodzajLadunku = "ADR"; correctInput = true; } else if (singleChoice.equals("N")) { rodzajLadunku = "N"; correctInput = true; } if (correctInput == false) { System.out.println("Niepoprawnie wpisana odpowiedz, sproboj ponownie"); } } //dokonywanie wyboru przewoznika //NIESTETY MUSISZ PRZEROBIC KAZDY NASTEPNY IF W TEN SPOSOB JAK WYGLADA TEN :( if(pozaGranice == true && niskieKoszty == true && iloscLadunku == true && szybkosc == true && rodzajLadunku.equals("P")) System.out.println("Hecksher Polska z o. o."); //------------------------------------------------------------------- else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(1)) System.out.println("Prezydent Polska"); else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(2)) System.out.println("SPEDCOM Sp. Z o. o. Spółka Cywilna"); else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(0)) System.out.println("Prezydent Polska"); else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(1)) System.out.println("Rabell Logistics"); else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(2)) System.out.println("Aquarius Gem Shipping Gabriela Szemrowicz"); else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(0)) System.out.println("Ewals Cargo Polska"); else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(1)) System.out.println("Prezydent Polska"); else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(2)) System.out.println("AutoAndreas"); else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(0)) System.out.println("Heckscher Polska z o. o."); else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(1)) System.out.println("Ewals Cargo Polska"); else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(2)) System.out.println("Apak Logistics"); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(0)) System.out.println("Heckscher Polska z o. o."); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(1)) System.out.println("A. Jezerski Sp. Z o. o."); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(2)) System.out.println("SPEDCOM Sp. Z o. o. Spółka Cywilna"); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(0)) System.out.println("Aquarius Gem Shipping Gabriela Szemrowicz"); if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(1)) System.out.println("Prezydent Polska"); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(2)) System.out.println("Ecu-Line Polska Sp. Z o. o."); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(0)) System.out.println("Bastaga S.C."); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(1)) System.out.println("Ewals Cargo Polska"); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(2)) System.out.println("AutoAndreas"); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(0)) System.out.println("Hecksher Polska z o. o."); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(1)) System.out.println("Prezydent Polska"); else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(2)) System.out.println("Auarius Gem Shipping Gabriela Szemrowicz"); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(0)) System.out.println("Hecksher Polska z o. o."); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(1)) System.out.println("Prezydent Polska"); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(2)) System.out.println("SPEDCOM Sp. Z o. o. Spółka Cywilna"); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(0)) System.out.println("Prezydent Polska"); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(1)) System.out.println("Ewals Cargo Polska"); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(2)) System.out.println("Ecu-Line Polska Sp. Z o. o."); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(0)) System.out.println("MIR_TRANS Mirosław Staniszewski"); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(1)) System.out.println("Rabell Logistics"); if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(2)) System.out.println("SPEDCOM Sp. Z o. o. Spółka Cywilna"); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(0)) System.out.println("MIR_TRANS Mirosław Staniszewski"); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(1)) System.out.println("A. Jezerski Sp. Z o. o."); else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(2)) System.out.println("Bastaga S.C"); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(0)) System.out.println("GH Spedition Sp. Z o. o."); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(1)) System.out.println("Wichot Transport"); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(1) && choice.get(4).equals(2)) System.out.println("SPEDCOM Sp. Z o. o. Spółka Cywilna"); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(0)) System.out.println("MIR_TRANS Mirosław Staniszewski"); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(1)) System.out.println("A. Jezerski Sp. Z o. o."); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1) && choice.get(3).equals(0) && choice.get(4).equals(2)) System.out.println("Ecu-Line Polska Sp. Z o. o."); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(0)) System.out.println("Rabell Logistics"); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(1)) System.out.println("GH Spedition Sp. Z o. o."); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(1) && choice.get(4).equals(2)) System.out.println("Apak Logistics"); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(0)) System.out.println("Rabell Logistics"); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(1)) System.out.println("Wichot Transport"); else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0) && choice.get(3).equals(0) && choice.get(4).equals(2)) System.out.println("Bastaga S.C."); } }