public static void main
(String[] args
) {
//deklaracja wszystkich zmiennych
Scanner scanner
= new Scanner
(System.
in);
Map
<Integer, Integer
> choice
= new HashMap
<>();
boolean correctInput = false;
//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")) {
choice.put(choiceCounter, 1);
correctInput = true;
} else if (singleChoice.equals("Nie")) {
choice.put(choiceCounter, 0);
correctInput = true;
}
if(correctInput == false) {
System.
out.
println("Niepoprawnie wpisana odpowiedz, sproboj ponownie");
}
}
//zwiekszenie zmiennej aby mozna bylo wpisac nastepny element do mapy, analogicznie przy nastepnych wyborach
choiceCounter++;
//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")) {
choice.put(choiceCounter, 1);
correctInput = true;
} else if (singleChoice.equals("Nie")) {
choice.put(choiceCounter, 0);
correctInput = true;
}
if(correctInput == false) {
System.
out.
println("Niepoprawnie wpisana odpowiedz, sproboj ponownie");
}
}
choiceCounter++;
correctInput = false;
System.
out.
println("Czy chcesz przewiezc mala ilosc ladunku? (Tak)/(Nie)");
while(correctInput == false) {
singleChoice = scanner.next();
if (singleChoice.equals("Tak")) {
choice.put(choiceCounter, 1);
correctInput = true;
} else if (singleChoice.equals("Nie")) {
choice.put(choiceCounter, 0);
correctInput = true;
}
if(correctInput == false) {
System.
out.
println("Niepoprawnie wpisana odpowiedz, sproboj ponownie");
}
}
choiceCounter++;
correctInput = false;
System.
out.
println("Czy zalezy Ci na szybkosci? (Tak)/(Nie)");
while(correctInput == false) {
singleChoice = scanner.next();
if (singleChoice.equals("Tak")) {
choice.put(choiceCounter, 1);
correctInput = true;
} else if (singleChoice.equals("Nie")) {
choice.put(choiceCounter, 0);
correctInput = true;
}
if(correctInput == false) {
System.
out.
println("Niepoprawnie wpisana odpowiedz, sproboj ponownie");
}
}
choiceCounter++;
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")) {
choice.put(choiceCounter, 0);
correctInput = true;
} else if (singleChoice.equals("ADR")) {
choice.put(choiceCounter, 1);
correctInput = true;
} else if (singleChoice.equals("N")) {
choice.put(choiceCounter, 2);
correctInput = true;
}
if (correctInput == false) {
System.
out.
println("Niepoprawnie wpisana odpowiedz, sproboj ponownie");
}
}
//dokonywanie wyboru przewoznika
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(0))
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.");
}
}