Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package virtualworld;
  7.  
  8. import java.util.ArrayList;
  9. import java.util.List;
  10. import java.util.Scanner;
  11.  
  12. /**
  13. *
  14. * @author MTAH
  15. */
  16. public class Virtualworld {
  17.  
  18. /**
  19. * @param args the command line arguments
  20. */
  21.  
  22. //to remove code from main, I have created separate methods
  23. //myApp gets whatever methods are in run() to execute
  24. public static void main(String[] args) {
  25. // TODO code application logic here
  26.  
  27. Virtualworld myApp = new Virtualworld();
  28. myApp.run();
  29.  
  30. }
  31.  
  32. private List<String> list;
  33.  
  34. //run is a method that gets the methods createClone and createPet to run
  35. public void run(){
  36.  
  37. createMenu();
  38. shoutOutCannedMessage();
  39. createClone();
  40. createPet();
  41.  
  42.  
  43. }
  44.  
  45. /*this is the createClone method, it takes input and manipulates the myclone class
  46. it produces an output by plugging in the data taken to myclone class and
  47. produces the introduction
  48. */
  49.  
  50.  
  51.  
  52. private void createMenu()
  53. {
  54. list = new ArrayList();
  55. list.add(0, " ");
  56. list.add(1, "1. Java is fun!");
  57. list.add(2, "2. Greece is famous for its archaeological history. ");
  58. list.add(3, "3. Spain has great churros and hot chocolate. ");
  59. list.add(4, "4. Sweden has beautiful architecture. ");
  60. list.add(5, "5. Choose Denmark if you love Lego! ");
  61. list.add(6, "6. South Africa has a great Safari option by Sun City!");
  62. list.add(7, "7. Japan is fun and filled with gorgeous cherry trees.");
  63. list.add(8, "8. The U.K. is a place with history right next to modernity");
  64. list.add(9, "9. This is a project for IT 511");
  65. list.add(10, "10. This was created by ");
  66. }
  67.  
  68. private void shoutOutCannedMessage()
  69. {
  70. System.out.println("This is a list of options: ");
  71. int size = list.size();
  72.  
  73. for(int i=0; i<size; i++)
  74. {
  75. System.out.println(list.get(i));
  76. }
  77.  
  78. int userNumber;
  79. Scanner scanner = new Scanner(System.in);
  80. System.out.println("Please enter number: ");
  81. userNumber = scanner.nextInt();
  82. System.out.println(list.get(userNumber));
  83.  
  84.  
  85. }
  86.  
  87.  
  88.  
  89. private void createClone()
  90. {
  91.  
  92. Scanner input = new Scanner(System.in);
  93.  
  94. System.out.println("Please enter your first name: ");
  95. String firstName = input.next();
  96.  
  97. System.out.println("Please enter your last name: ");
  98. String lastName = input.next();
  99.  
  100. myclone individual = new myclone(firstName, lastName);
  101. System.out.println(individual.introduction());
  102.  
  103. }
  104.  
  105. /*this is the createPet method, it takes input and manipulates the pet class
  106. it produces an output by plugging in the data taken to pet class and
  107. produces the pet's introduction
  108. */
  109.  
  110. private void createPet()
  111. {
  112.  
  113. Scanner input = new Scanner(System.in);
  114.  
  115. System.out.println("Please enter the type of animal your pet will be (Ex. cat, dog, etc): ");
  116. String animalType = input.next();
  117.  
  118. System.out.println("Please enter what color you want your pet to be (Ex. blue, green, brown, white): ");
  119. String animalColor = input.next();
  120.  
  121. System.out.println("Please enter your pet's name: ");
  122. String animalName = input.next();
  123.  
  124. pet kind = new pet(animalType, animalColor, animalName);
  125. System.out.println(kind.petIntroduction());
  126.  
  127.  
  128. }
  129.  
  130.  
  131.  
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement