Facebook
From Łukasz, 6 Years ago, written in Java.
Embed
Download Paste or View Raw
Hits: 250
  1.  
  2. package pracaDomowa4;
  3.  
  4. import java.util.HashMap;
  5. import java.util.InputMismatchException;
  6. import java.util.Map;
  7. import java.util.Scanner;
  8.  
  9.  
  10.  
  11.     public class Start{
  12.         public static void main(String[] args) {
  13.            
  14.             Map<String, Integer> map1 = new HashMap<>();            
  15.             map1.put("R", 1);            
  16.             map1.put("A", 1);                        
  17.             map1.put("D", 1);                        
  18.             map1.put("I", 1);            
  19.             map1.put("O", 1);
  20.            
  21.             Map<String, Integer> map2 = new HashMap<>();
  22.             map2.put("R", 2);
  23.             map2.put("A", 2);
  24.             map2.put("D", 2);
  25.             map2.put("I", 2);
  26.             map2.put("O", 2);
  27.            
  28.             Map<String, Integer> map3 = new HashMap<>();
  29.             map3.put("R", 3);
  30.             map3.put("A", 3);
  31.             map3.put("D", 3);
  32.             map3.put("I", 3);
  33.             map3.put("O", 3);
  34.            
  35.             Scanner s = new Scanner(System.in);
  36.             System.out.println("Podaj jedną z liter: R,A,D,I,O: ");
  37.             try{
  38.             String letter = s.nextLine();
  39.             System.out.println("Podaj liczbę od 1 do 3: ");
  40.             int value = s.nextInt();
  41.            
  42.            
  43.            
  44.             if("R".equals(letter) && value == 1){
  45.             if (map1.containsKey(letter) && map1.containsValue(value)){
  46.                 System.out.println("Brawo wygrałeś 15 zł!!!");
  47.             }
  48.  
  49.            
  50.             }
  51.      
  52.             if("A".equals(letter) && value == 1){
  53.             if (map1.containsKey(letter) && map1.containsValue(value)){
  54.                 System.out.println("Brawo wygrałeś 50 zł!!!");
  55.             }
  56.            
  57.            
  58.             }
  59.            
  60.             if("D".equals(letter) && value == 1){
  61.             if (map1.containsKey(letter) && map1.containsValue(value)){
  62.                 System.out.println("Brawo wygrałeś 70 zł!!!");
  63.             }
  64.            
  65.            
  66.             }
  67.            
  68.             if("I".equals(letter) && value == 1){
  69.             if (map1.containsKey(letter) && map1.containsValue(value)){
  70.                 System.out.println("Brawo wygrałeś 30 zł!!!");
  71.             }
  72.            
  73.            
  74.             }
  75.            
  76.             if("O".equals(letter) && value == 1){
  77.             if (map1.containsKey(letter) && map1.containsValue(value)){
  78.                 System.out.println("Brawo wygrałeś 60 zł!!!");
  79.             }
  80.            
  81.            
  82.             }
  83.            
  84.            
  85.            
  86.             if("R".equals(letter) && value == 2){
  87.             if (map2.containsKey(letter) && map2.containsValue(value)){
  88.                 System.out.println("Brawo wygrałeś 10 zł!!!");
  89.             }
  90.            
  91.            
  92.             }
  93.             if("A".equals(letter) && value == 2){
  94.             if (map2.containsKey(letter) && map2.containsValue(value)){
  95.                 System.out.println("Brawo wygrałeś 75 zł!!!");
  96.             }
  97.            
  98.            
  99.             }
  100.             if("D".equals(letter) && value == 2){
  101.             if (map2.containsKey(letter) && map2.containsValue(value)){
  102.                 System.out.println("Brawo wygrałeś 95 zł!!!");
  103.             }
  104.            
  105.            
  106.             }
  107.             if("I".equals(letter) && value == 2){
  108.             if (map2.containsKey(letter) && map2.containsValue(value)){
  109.                 System.out.println("Brawo wygrałeś 1 zł!!!");
  110.             }
  111.            
  112.            
  113.             }
  114.             if("O".equals(letter) && value == 2){
  115.             if (map2.containsKey(letter) && map2.containsValue(value)){
  116.                 System.out.println("Brawo wygrałeś 25 zł!!!");
  117.             }
  118.            
  119.            
  120.             }
  121.            
  122.            
  123.             if("R".equals(letter) && value == 3){
  124.             if (map3.containsKey(letter) && map3.containsValue(value)){
  125.                 System.out.println("Brawo wygrałeś 2 zł!!!");
  126.             }
  127.            
  128.            
  129.             }
  130.             if("A".equals(letter) && value == 3){
  131.             if (map3.containsKey(letter) && map3.containsValue(value)){
  132.                 System.out.println("Brawo wygrałeś 99 zł!!!");
  133.             }
  134.            
  135.            
  136.             }
  137.             if("D".equals(letter) && value == 3){
  138.             if (map3.containsKey(letter) && map3.containsValue(value)){
  139.                 System.out.println("Brawo wygrałeś 100 zł!!!");
  140.             }
  141.            
  142.            
  143.             }
  144.             if("I".equals(letter) && value == 3){
  145.             if (map3.containsKey(letter) && map3.containsValue(value)){
  146.                 System.out.println("Brawo wygrałeś 72 zł!!!");
  147.             }
  148.            
  149.            
  150.             }
  151.             if("O".equals(letter) && value == 3){
  152.             if (map3.containsKey(letter) && map3.containsValue(value)){
  153.                 System.out.println("Brawo wygrałeś 49 zł!!!");
  154.             }
  155.            
  156.            
  157.             }
  158.             }catch(InputMismatchException e){
  159.                 System.err.println("Podana zła wartość: " + e);
  160.             }
  161.                
  162.            
  163.            
  164.       }
  165.            
  166.         }
  167.            
  168.            
  169.            
  170.            
  171.            
  172.            
  173.        
  174.  
  175.    
  176.    
  177.    
  178.    
  179.  
  180.