Advertisement
jbonanno

FortuneTell.Java

Jun 18th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.04 KB | None | 0 0
  1. package FortuneTell;
  2.  
  3.  
  4. import java.util.Scanner;
  5. import java.util.ArrayList;
  6. import java.io.*;
  7.  
  8.  
  9. public class FortuneTell {
  10.  
  11.    
  12.     public static void main(String[] args) {
  13.  
  14.  
  15.  
  16. Scanner sc = new Scanner(System.in);
  17.  
  18.  
  19.  
  20.  
  21.    
  22.  
  23.  
  24.  
  25.     public int mainMenu(Scanner sc) {
  26.         String menu = "";
  27.         menu += "FORTUNE TELLER 2000 \n";
  28.         menu += "  Welcome friend!!! This will tell your future! \n";
  29.         menu += "  Please enter the number of your birth month \n";
  30.        menu += "  1: January  \n";
  31.         menu += " 2: February \n";
  32.         menu += " 3: March  \n";
  33.        menu += "  4: April \n";
  34.         menu += " 5: May \n";
  35.           menu += " 6: June \n";
  36.         menu += " 7: July \n";
  37.         menu += " 8: August \n";
  38.        menu += "  9 September \n";
  39.         menu += " 10: October \n";
  40.          menu += " 11: November \n";
  41.           menu += " 12: December \n";
  42.         System.out.println(menu);
  43.             int birthMonth = sc.nextInt();
  44.              System.out.println();
  45.         return birthMonth;
  46.     }
  47.    
  48.    
  49.    
  50.    
  51.  
  52. private void translateBirthMonth(int birthMonth)
  53. {
  54. if (birthMonth == 1)
  55. {
  56.   String fortune = "";
  57.         fortune += "You will become very rich \n";
  58.         System.out.println(fortune);
  59.         getFavoriteNumbers();
  60. }
  61. else if (birthMonth ==2)
  62. {
  63. String fortune = "";
  64.         fortune += "You will lose some money \n";
  65.         System.out.println(fortune);
  66.         getFavoriteNumbers();
  67. }
  68. else if ( birthMonth == 3 )
  69. {
  70. String fortune = "";
  71.         fortune += "You will meet someone new \n";
  72.         System.out.println(fortune);
  73.         getFavoriteNumbers();
  74. }
  75. else if ( birthMonth == 4)
  76. {
  77. String fortune = "";
  78.         fortune += "You will see another country \n";
  79.         System.out.println(fortune);
  80.         getFavoriteNumbers();
  81. }
  82. else if (birthMonth ==5)
  83. {
  84. String fortune = "";
  85.         fortune += "You will discover the secret of life \n";
  86.         System.out.println(fortune);
  87.         getFavoriteNumbers();
  88. }
  89. else if (birthMonth == 6)
  90. {
  91. String fortune = "";
  92.         fortune += "You will move to a new city \n";
  93.         System.out.println(fortune);
  94.         getFavoriteNumbers();
  95. }
  96.  
  97.  if (birthMonth == 7)
  98. {
  99. String fortune = "";
  100.         fortune += "You may lose touch with a close friend if not careful \n";
  101.         System.out.println(fortune);
  102.         getFavoriteNumbers();
  103. }
  104. else if (birthMonth == 8)
  105. {
  106. String fortune = "";
  107.         fortune += "Your effort will determine your success at your career \n";
  108.         System.out.println(fortune);
  109.         getFavoriteNumbers();
  110. }
  111. else if (birthMonth == 9)
  112. {
  113. String fortune = "";
  114.         fortune += "You will discover a hidden secret \n";
  115.         System.out.println(fortune);
  116.         getFavoriteNumbers();
  117. }
  118.  
  119.  
  120. else if (birthMonth == 10)
  121. {
  122. String fortune = "";
  123.         fortune += "You will solve many problems \n";
  124.         System.out.println(fortune);
  125.         getFavoriteNumbers();
  126. }
  127.  
  128. else if (birthMonth == 11)
  129. {
  130. String fortune = "";
  131.         fortune += "Your dreams will become reality \n";
  132.         System.out.println(fortune);
  133.         getFavoriteNumbers();
  134. }
  135. else if (birthMonth == 12)
  136. {
  137. String fortune = "";
  138.         fortune += "You will climb Mount Everest \n";
  139.         System.out.println(fortune);
  140.         getFavoriteNumbers();
  141. }
  142. // below is validation!
  143. else
  144. {
  145.  String fortune = "";
  146.         fortune += "ERROR!! Invalid input! Please enter a number between 1 and 12 \n";
  147.         System.out.println(fortune);  
  148.        continue;
  149.  
  150.         }
  151.  
  152. }
  153.  
  154. public int leastFavoriteNumber()
  155. {    
  156.  
  157. try
  158. {
  159.   Scanner in = new Scanner(System.in);
  160.   String number =  "Please enter your first favorite number \n";
  161. System.out.print(number);
  162. int leastFavoriteNum = in.nextInt();
  163. return leastFavoriteNum;
  164.  
  165. }
  166. catch (Exception e)
  167. {
  168.     String error = "";
  169.         error += "ERROR!! Invalid input! Please enter an integer \n";
  170.         System.out.println(error);
  171.         in.next();
  172.        continue;
  173. }
  174.    
  175. }
  176.    
  177.  
  178.  
  179.  
  180.  
  181. public void interpretLeastFavoriteNumber(int leastFavoriteNum)
  182. {
  183. if (leastFavoriteNum < 0)
  184. {
  185. String fortune3 = "";
  186.         fortune3 += "You will climb Mount Everest \n";
  187.         System.out.println(fortune3);
  188.  
  189. }
  190. else if( leastFavoriteNum=< 0 && leastFavoriteNumber >= 10);
  191. {
  192. String fortune3 = "";
  193.         fortune3 += "You are very lucky \n";
  194.         System.out.println(fortune3);
  195.  
  196. else if(leastFavoriteNum > 10)
  197. {
  198. String fortune3 = "";
  199.         fortune3 += "Your special number has special meaning in your life \n";
  200.         System.out.println(fortune3);
  201.  
  202.  
  203. }
  204.  
  205.        
  206. public int getFavoriteNumbers();
  207. {
  208.     int favoriteNumberArray[];
  209. favoriteNumberArray = new int [3];
  210. Scanner in = new Scanner(System.in);
  211.  
  212.   String favorite = "";
  213.         favorite += "Please enter your first favorite numer \n";
  214. favoriteNumberArray[1]  = in.nextInt();
  215.  
  216. String favorite2 = "";
  217.         favorite2 += "Please enter your second favorite numer \n";
  218. favoriteNumberArray[2]  = in.nextInt();
  219.  
  220. String favorite3 = "";
  221.         favorite3 += "Please enter your third favorite numer \n";
  222. favoriteNumberArray[3]  = in.nextInt();
  223. int total = favoriteNumberArray[1]+ favoriteNumberArray[2] + favoriteNumberArray[3];
  224. return total;
  225. }
  226. }
  227.  
  228. public void favoriteNumbersInterpreter(int total)
  229. {
  230. if( total < 0)
  231. {
  232. String fortune2 = "";
  233.         fortune2 += "You will think outside of the box \n";
  234.         System.out.println(fortune2);
  235. }
  236.         else if (total == 0)
  237.         {
  238.             String fortune2 = "";
  239.         fortune2 += "You feel that no one understands you \n";
  240.         System.out.println(fortune2);
  241.         }
  242.        
  243. else if ( total > 0 && total <=10)
  244. {
  245. String fortune2 = "";
  246.         fortune2 += "You like to do things the simple way \n";
  247.         System.out.println(fortune2);
  248. }
  249. else if ( total > 10 && total <=300)
  250.  
  251. {
  252. String fortune2 = "";
  253.         fortune2 += "You hold many things dear to your heart \n";
  254.         System.out.println(fortune2);
  255. }
  256. else
  257. {
  258. String fortune2 = "";
  259.         fortune2 += "You really think big!! \n";
  260.         System.out.println(fortune2);
  261. }
  262. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement