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