Facebook
From Unreliable Anoa, 7 Years ago, written in Java.
Embed
Download Paste or View Raw
Hits: 339
  1.    public static void main(String[] args) {
  2.  
  3.         //deklaracja wszystkich zmiennych
  4.         Scanner scanner = new Scanner(System.in);
  5.         Integer choiceCounter = 0;
  6.         Map<Integer, Integer> choice = new HashMap<>();
  7.         String singleChoice;
  8.         boolean correctInput = false;
  9.  
  10.         //pierwszy wybor
  11.         System.out.println("Czy chcesz przewiezc ladunek poza granice kraju? (Tak)/(Nie)");
  12.         //jesli tak, to wybor jest umieszczany hashmapie jako 1,
  13.         // czyli dla klucza o wartosci w tym przypadku 0 przypisywanie jest 1.
  14.         //Analogicznie dla przypadku kiedy wybor jest nie
  15.         while(correctInput == false) {
  16.             singleChoice = scanner.next();
  17.             if (singleChoice.equals("Tak")) {
  18.                 choice.put(choiceCounter, 1);
  19.                 correctInput = true;
  20.             } else if (singleChoice.equals("Nie")) {
  21.                 choice.put(choiceCounter, 0);
  22.                 correctInput = true;
  23.             }
  24.             if(correctInput == false) {
  25.                 System.out.println("Niepoprawnie wpisana odpowiedz, sproboj ponownie");
  26.             }
  27.         }
  28.         //zwiekszenie zmiennej aby mozna bylo wpisac nastepny element do mapy, analogicznie przy nastepnych wyborach
  29.         choiceCounter++;
  30.         //resetowanie zmiennej idioto-odpornej, analogicznie dalej
  31.         correctInput = false;
  32.  
  33.         System.out.println("Czy zalezy Ci na niskich kosztach? (Tak)/(Nie)");
  34.         while(correctInput == false) {
  35.             singleChoice = scanner.next();
  36.             if (singleChoice.equals("Tak")) {
  37.                 choice.put(choiceCounter, 1);
  38.                 correctInput = true;
  39.             } else if (singleChoice.equals("Nie")) {
  40.                 choice.put(choiceCounter, 0);
  41.                 correctInput = true;
  42.             }
  43.             if(correctInput == false) {
  44.                 System.out.println("Niepoprawnie wpisana odpowiedz, sproboj ponownie");
  45.             }
  46.         }
  47.         choiceCounter++;
  48.         correctInput = false;
  49.  
  50.         System.out.println("Czy chcesz przewiezc mala ilosc ladunku? (Tak)/(Nie)");
  51.         while(correctInput == false) {
  52.             singleChoice = scanner.next();
  53.             if (singleChoice.equals("Tak")) {
  54.                 choice.put(choiceCounter, 1);
  55.                 correctInput = true;
  56.             } else if (singleChoice.equals("Nie")) {
  57.                 choice.put(choiceCounter, 0);
  58.                 correctInput = true;
  59.             }
  60.             if(correctInput == false) {
  61.                 System.out.println("Niepoprawnie wpisana odpowiedz, sproboj ponownie");
  62.             }
  63.         }
  64.         choiceCounter++;
  65.         correctInput = false;
  66.  
  67.         System.out.println("Czy zalezy Ci na szybkosci? (Tak)/(Nie)");
  68.         while(correctInput == false) {
  69.             singleChoice = scanner.next();
  70.             if (singleChoice.equals("Tak")) {
  71.                 choice.put(choiceCounter, 1);
  72.                 correctInput = true;
  73.             } else if (singleChoice.equals("Nie")) {
  74.                 choice.put(choiceCounter, 0);
  75.                 correctInput = true;
  76.             }
  77.             if(correctInput == false) {
  78.                 System.out.println("Niepoprawnie wpisana odpowiedz, sproboj ponownie");
  79.             }
  80.         }
  81.         choiceCounter++;
  82.         correctInput = false;
  83.  
  84.         System.out.println("Wybierz rodzaj ładunku:");
  85.         System.out.println("Ponadgabarytowy (P),");
  86.         System.out.println("Niebiezpieczny (ADR),");
  87.         System.out.println("Normalny (N)");
  88.         while(correctInput == false) {
  89.             singleChoice = scanner.next();
  90.             if (singleChoice.equals("P")) {
  91.                 choice.put(choiceCounter, 0);
  92.                 correctInput = true;
  93.             } else if (singleChoice.equals("ADR")) {
  94.                 choice.put(choiceCounter, 1);
  95.                 correctInput = true;
  96.             } else if (singleChoice.equals("N")) {
  97.                 choice.put(choiceCounter, 2);
  98.                 correctInput = true;
  99.             }
  100.             if (correctInput == false) {
  101.                 System.out.println("Niepoprawnie wpisana odpowiedz, sproboj ponownie");
  102.             }
  103.         }
  104.  
  105.  
  106.         //dokonywanie wyboru przewoznika
  107.         if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1)
  108.                 && choice.get(3).equals(1) && choice.get(4).equals(0))
  109.             System.out.println("Hecksher Polska z o. o.");
  110.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1)
  111.                 && choice.get(3).equals(1) && choice.get(4).equals(1))
  112.             System.out.println("Prezydent Polska");
  113.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1)
  114.                 && choice.get(3).equals(1) && choice.get(4).equals(2))
  115.             System.out.println("SPEDCOM Sp. Z o. o. Spółka Cywilna");
  116.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1)
  117.                 && choice.get(3).equals(0) && choice.get(4).equals(0))
  118.             System.out.println("Prezydent Polska");
  119.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1)
  120.                 && choice.get(3).equals(0) && choice.get(4).equals(1))
  121.             System.out.println("Rabell Logistics");
  122.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(1)
  123.                 && choice.get(3).equals(0) && choice.get(4).equals(2))
  124.             System.out.println("Aquarius Gem Shipping Gabriela Szemrowicz");
  125.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0)
  126.                 && choice.get(3).equals(1) && choice.get(4).equals(0))
  127.             System.out.println("Ewals Cargo Polska");
  128.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0)
  129.                 && choice.get(3).equals(1) && choice.get(4).equals(1))
  130.             System.out.println("Prezydent Polska");
  131.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0)
  132.                 && choice.get(3).equals(1) && choice.get(4).equals(2))
  133.             System.out.println("AutoAndreas");
  134.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0)
  135.                 && choice.get(3).equals(0) && choice.get(4).equals(0))
  136.             System.out.println("Heckscher Polska z o. o.");
  137.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0)
  138.                 && choice.get(3).equals(0) && choice.get(4).equals(1))
  139.             System.out.println("Ewals Cargo Polska");
  140.         else if(choice.get(0).equals(1) && choice.get(1).equals(1) && choice.get(2).equals(0)
  141.                 && choice.get(3).equals(0) && choice.get(4).equals(2))
  142.             System.out.println("Apak Logistics");
  143.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1)
  144.                 && choice.get(3).equals(1) && choice.get(4).equals(0))
  145.             System.out.println("Heckscher Polska z o. o.");
  146.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1)
  147.                 && choice.get(3).equals(1) && choice.get(4).equals(1))
  148.             System.out.println("A. Jezerski Sp. Z o. o.");
  149.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1)
  150.                 && choice.get(3).equals(1) && choice.get(4).equals(2))
  151.             System.out.println("SPEDCOM Sp. Z o. o. Spółka Cywilna");
  152.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1)
  153.                 && choice.get(3).equals(0) && choice.get(4).equals(0))
  154.             System.out.println("Aquarius Gem Shipping Gabriela Szemrowicz");
  155.         if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1)
  156.                 && choice.get(3).equals(0) && choice.get(4).equals(1))
  157.             System.out.println("Prezydent Polska");
  158.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(1)
  159.                 && choice.get(3).equals(0) && choice.get(4).equals(2))
  160.             System.out.println("Ecu-Line Polska Sp. Z o. o.");
  161.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0)
  162.                 && choice.get(3).equals(1) && choice.get(4).equals(0))
  163.             System.out.println("Bastaga S.C.");
  164.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0)
  165.                 && choice.get(3).equals(1) && choice.get(4).equals(1))
  166.             System.out.println("Ewals Cargo Polska");
  167.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0)
  168.                 && choice.get(3).equals(1) && choice.get(4).equals(2))
  169.             System.out.println("AutoAndreas");
  170.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0)
  171.                 && choice.get(3).equals(0) && choice.get(4).equals(0))
  172.             System.out.println("Hecksher Polska z o. o.");
  173.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0)
  174.                 && choice.get(3).equals(0) && choice.get(4).equals(1))
  175.             System.out.println("Prezydent Polska");
  176.         else if(choice.get(0).equals(1) && choice.get(1).equals(0) && choice.get(2).equals(0)
  177.                 && choice.get(3).equals(0) && choice.get(4).equals(2))
  178.             System.out.println("Auarius Gem Shipping Gabriela Szemrowicz");
  179.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1)
  180.                 && choice.get(3).equals(1) && choice.get(4).equals(0))
  181.             System.out.println("Hecksher Polska z o. o.");
  182.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1)
  183.                 && choice.get(3).equals(1) && choice.get(4).equals(1))
  184.             System.out.println("Prezydent Polska");
  185.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1)
  186.                 && choice.get(3).equals(1) && choice.get(4).equals(2))
  187.             System.out.println("SPEDCOM Sp. Z o. o. Spółka Cywilna");
  188.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1)
  189.                 && choice.get(3).equals(0) && choice.get(4).equals(0))
  190.             System.out.println("Prezydent Polska");
  191.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1)
  192.                 && choice.get(3).equals(0) && choice.get(4).equals(1))
  193.             System.out.println("Ewals Cargo Polska");
  194.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(1)
  195.                 && choice.get(3).equals(0) && choice.get(4).equals(2))
  196.             System.out.println("Ecu-Line Polska Sp. Z o. o.");
  197.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0)
  198.                 && choice.get(3).equals(1) && choice.get(4).equals(0))
  199.             System.out.println("MIR_TRANS Mirosław Staniszewski");
  200.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0)
  201.                 && choice.get(3).equals(1) && choice.get(4).equals(1))
  202.             System.out.println("Rabell Logistics");
  203.         if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0)
  204.                 && choice.get(3).equals(1) && choice.get(4).equals(2))
  205.             System.out.println("SPEDCOM Sp. Z o. o. Spółka Cywilna");
  206.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0)
  207.                 && choice.get(3).equals(0) && choice.get(4).equals(0))
  208.             System.out.println("MIR_TRANS Mirosław Staniszewski");
  209.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0)
  210.                 && choice.get(3).equals(0) && choice.get(4).equals(1))
  211.             System.out.println("A. Jezerski Sp. Z o. o.");
  212.         else if(choice.get(0).equals(0) && choice.get(1).equals(1) && choice.get(2).equals(0)
  213.                 && choice.get(3).equals(0) && choice.get(4).equals(2))
  214.             System.out.println("Bastaga S.C");
  215.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1)
  216.                 && choice.get(3).equals(1) && choice.get(4).equals(0))
  217.             System.out.println("GH Spedition Sp. Z o. o.");
  218.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1)
  219.                 && choice.get(3).equals(1) && choice.get(4).equals(1))
  220.             System.out.println("Wichot Transport");
  221.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1)
  222.                 && choice.get(3).equals(1) && choice.get(4).equals(2))
  223.             System.out.println("SPEDCOM Sp. Z o. o. Spółka Cywilna");
  224.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1)
  225.                 && choice.get(3).equals(0) && choice.get(4).equals(0))
  226.             System.out.println("MIR_TRANS Mirosław Staniszewski");
  227.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1)
  228.                 && choice.get(3).equals(0) && choice.get(4).equals(1))
  229.             System.out.println("A. Jezerski Sp. Z o. o.");
  230.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(1)
  231.                 && choice.get(3).equals(0) && choice.get(4).equals(2))
  232.             System.out.println("Ecu-Line Polska Sp. Z o. o.");
  233.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0)
  234.                 && choice.get(3).equals(1) && choice.get(4).equals(0))
  235.             System.out.println("Rabell Logistics");
  236.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0)
  237.                 && choice.get(3).equals(1) && choice.get(4).equals(1))
  238.             System.out.println("GH Spedition Sp. Z o. o.");
  239.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0)
  240.                 && choice.get(3).equals(1) && choice.get(4).equals(2))
  241.             System.out.println("Apak Logistics");
  242.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0)
  243.                 && choice.get(3).equals(0) && choice.get(4).equals(0))
  244.             System.out.println("Rabell Logistics");
  245.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0)
  246.                 && choice.get(3).equals(0) && choice.get(4).equals(1))
  247.             System.out.println("Wichot Transport");
  248.         else if(choice.get(0).equals(0) && choice.get(1).equals(0) && choice.get(2).equals(0)
  249.                 && choice.get(3).equals(0) && choice.get(4).equals(2))
  250.             System.out.println("Bastaga S.C.");
  251.     }
  252. }