Advertisement
Guest User

9gag personality type calculator

a guest
Apr 25th, 2015
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.25 KB | None | 0 0
  1. /*
  2.  * Copyright (c) 2012-2015, RaveN Network INC. and/or its affiliates. All rights reserved.
  3.  * RAVEN NETWORK INC. PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4.  *
  5.  * Licensed Materials - Property of RaveN Network INC.
  6.  * Restricted Rights - Use, duplication or disclosure restricted.
  7.  */
  8. package net.myproject;
  9.  
  10. import java.util.ArrayList;
  11. import java.util.HashMap;
  12. import java.util.List;
  13. import java.util.Map;
  14.  
  15. /**
  16.  * @author lord_rex (Reginald Ravenhorst)
  17.  * @see <a href="https://scontent-vie.xx.fbcdn.net/hphotos-xap1/t31.0-8/11174626_10153436239596840_2843054075889467255_o.jpg">9GAG Image</a>
  18.  */
  19. public final class PersonalityCalculator
  20. {
  21.     private static final Map<Integer, String> PERSONALITY_TYPES = new HashMap<>();
  22.     static
  23.     {
  24.         PERSONALITY_TYPES.put(1, "Kind");
  25.         PERSONALITY_TYPES.put(2, "Honest");
  26.         PERSONALITY_TYPES.put(3, "Faithful");
  27.         PERSONALITY_TYPES.put(4, "Caring");
  28.         PERSONALITY_TYPES.put(5, "Passionate");
  29.         PERSONALITY_TYPES.put(6, "Romantic");
  30.         PERSONALITY_TYPES.put(7, "Gentle");
  31.         PERSONALITY_TYPES.put(8, "Reliable");
  32.         PERSONALITY_TYPES.put(9, "Asshole");
  33.         PERSONALITY_TYPES.put(10, "Adventurous");
  34.         PERSONALITY_TYPES.put(11, "Sensitive");
  35.         PERSONALITY_TYPES.put(12, "Protective");
  36.     }
  37.    
  38.     private static List<Integer> convertToDigits(int i)
  39.     {
  40.         final List<Integer> digits = new ArrayList<>();
  41.        
  42.         while (i > 0)
  43.         {
  44.             digits.add(0, i % 10);
  45.             i = i / 10;
  46.         }
  47.        
  48.         return digits;
  49.     }
  50.    
  51.     /**
  52.      * @param args
  53.      */
  54.     public static void main(String[] args)
  55.     {
  56.         // Pick any number between 1 to 9.
  57.         int selectedNumber = 1; // TODO <--- THIS IS YOUR CHOICE, CHANGE IT!
  58.        
  59.         if ((selectedNumber < 1) || (selectedNumber > 9))
  60.         {
  61.             throw new UnsupportedOperationException("Between 1 to 9!");
  62.         }
  63.        
  64.         // Multiply it with 3.
  65.         selectedNumber *= 3;
  66.        
  67.         // Add 3.
  68.         selectedNumber += 3;
  69.        
  70.         // Now again multiply it with 3.
  71.         selectedNumber *= 3;
  72.        
  73.         // You will get 2 digits.
  74.         final List<Integer> digits = convertToDigits(selectedNumber);
  75.        
  76.         // Now add them.
  77.         selectedNumber = digits.get(0) + digits.get(1);
  78.        
  79.         // Now this number will tell you what you really are...
  80.         System.out.println("Your personality type is: " + PERSONALITY_TYPES.get(selectedNumber) + ".");
  81.     }
  82.    
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement