SHARE
TWEET

Untitled

a guest Oct 14th, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Hend Al-Zeer
  2.  * Help from Mr. David
  3.  * adventure project: Vogue Quiz
  4.  */
  5.  
  6. import java.util.Scanner;
  7. //defining string variables for the multiple inputs of the methods
  8. public class AdventureProjectt {
  9.     private String seasonQuestionAns;
  10.     private String lifestyleAns;
  11.     private String snack;
  12.     private String song;
  13.     private String activity;
  14.     private String phone;
  15.     private Scanner input = new Scanner(System.in);
  16.  
  17.     //introduce game and get name
  18.     public void introduction() {
  19.         System.out.println("What is your name?");
  20.         String answer = input.next();
  21.         System.out.println("Welcome " + answer + "!"  + "\n To \"Know Yourself Better\""
  22.                 + " vogue quiz! \r In this quiz an analysis will be given \r about your personality "
  23.                 + "based on \r your answers to a couple of random questions");
  24.        
  25.         System.out.println("Want to try it out? \r a.Yes \r b.No");
  26.         String firstTry = input.next();
  27.         if (firstTry.equals("a")) {
  28.             firstQuestion();
  29.         }
  30.         else if (firstTry.equals("b")) {
  31.             System.out.println("Why not? You are missing out!");
  32.         }
  33.         else {
  34.             input_error();
  35.         }
  36.         }
  37.     public void ending() {
  38.         System.out.println("Thank you for taking this quiz! \r we hope it made you discover yourself \r more!");
  39.     }
  40.    
  41.    
  42.     //first question method that sends player to other methods based on answer
  43.     public void firstQuestion() {
  44.         System.out.println("Pick a letter: \r a.1 \r b.2");
  45.         String answer = input.next();
  46.         if (answer.equals("a")) {
  47.             seasonQuestion();
  48.         }
  49.         else if (answer.equals("b")){
  50.             lifestyleQuestion();
  51.         }
  52.         else {
  53.             input_error();
  54.         }
  55.     }
  56.    
  57.     //if you answered a to first question to previous question, this method runs
  58.     public void seasonQuestion() {
  59.         System.out.println("What season do you prefer?\r Do you like the slow beat of the rain \r as it hits the ground"
  60.                 + " \r or do you prefer the active \r lifestyle granted to people \r in the summer? \r a. Winter \r b.Summer");
  61.         seasonQuestionAns = input.next();
  62.         seasonAns();
  63.  
  64.         if (seasonQuestionAns.equals("a")){
  65.             middDaySnackQ();
  66.         }
  67.         else if (seasonQuestionAns.equals("b")) {
  68.             phoneQ();
  69.         }
  70.         else {
  71.             input_error();
  72.         }
  73.         }
  74.     public void middDaySnackQ() {
  75.         System.out.println("As a midday snack, what do you prefer? \r a. Melted Chocolate cake \r b. Popsicles");
  76.         snack = input.next();
  77.         snackAns();
  78.         ending();
  79.     }
  80.     public void phoneQ() {
  81.         System.out.println("What would you pick: \r a.Iphone \r b.Samsung");
  82.         phone = input.next();
  83.         phoneAns();
  84.         ending();
  85.     }
  86.     //if you answered "b" to previous question, this method runs
  87.     public void lifestyleQuestion() {
  88.         System.out.println("If you had to pick between these two \r what would you pick? \r a. City lifestyle \r b. Countryside Lifestyle");
  89.         lifestyleAns = input.next();
  90.         lifeStyle();
  91.         if (lifestyleAns.equals("a")) {
  92.              musicQ();
  93.              songAns();
  94.              ending();
  95.         }
  96.         else if (lifestyleAns.equals("b")) {
  97.             activityQ();
  98.             activityAns();
  99.             ending();          
  100.         }
  101.         else {
  102.             input_error();
  103.         }
  104.     }
  105.    
  106.     public void musicQ() {
  107.         System.out.println("It is time for music now! Which song do you prefer? \r a.Fly me to the moon \r b.Flip the Switch");
  108.         song = input.next();
  109.        
  110.     }
  111.     public void activityQ() {
  112.         System.out.println("What would you prefer?\r a. movie night at home \r b.Spending a night at the stadium ");
  113.         activity = input.next();
  114.     }
  115.     /* the following methods are an additional feature to the adventure game, it shows
  116.     results that are previously saved and based on them prints out different conclusions */
  117.    
  118.     public void seasonAns() {
  119.         if (seasonQuestionAns.equals("a")) {
  120.             System.out.println("You prefer the cold and the soothing sound \r of the rain drops hitting the ground");
  121.         }
  122.         else if (seasonQuestionAns.equals("b")) {
  123.             System.out.println("ANALYSIS: You prefer the active lifestyle granted by the summer. ");
  124.         }
  125.         else {
  126.             System.out.print("NA");
  127.         }
  128.     }
  129.     public void snackAns() {
  130.         if (snack.equals("a")) {
  131.             System.out.println("ANALYSIS: You have a sweet tooth");
  132.         }
  133.         else if (snack.equals("b")) {
  134.             System.out.println("ANALYSIS: You enjoy the fresh taste of ice-cream!");
  135.         }
  136.         else {
  137.             System.out.print("NA");
  138.         }
  139.     }
  140.     public void phoneAns() {
  141.         if (phone.equals("a")) {
  142.             System.out.print("ANALYSIS: You are an asthetic person that likes \r to take asthetic pictures on their IPhone");
  143.         }
  144.         else if (phone.equals("b")) {
  145.             System.out.print("ANALYSIS: You are a practical person that prefers practicality  \r over looks by choosing Samsung.");
  146.         }
  147.         else {
  148.             System.out.print("NA");
  149.         }
  150.     }
  151.     public void lifeStyle() {
  152.         if (lifestyleAns.equals("a")) {
  153.             System.out.print("ANALYSIS: You enjoy the feeling of rush");
  154.         }
  155.         else if (lifestyleAns.equals("b")) {
  156.             System.out.print("ANALYSIS: You are a calm person who enjoys the nature");
  157.         }
  158.         else {
  159.             System.out.print("NA");
  160.         }
  161.     }
  162.     public void songAns() {
  163.         if (song.equals("a")) {
  164.             System.out.print("ANALYSIS: You enjoy classics which portrays your wise, old-school personality");
  165.         }
  166.         else if (song.equals("b")) {
  167.             System.out.print("ANALYSIS: You enjoy upbeat music which portrays your outgoing personality");
  168.         }
  169.         else {
  170.             System.out.print("NA");
  171.         }
  172.     }
  173.     public void activityAns() {
  174.         if (activity.equals("a")) {
  175.             System.out.print("ANALYSIS: You are a quiet person that favors quality time");
  176.         }
  177.         else if (activity.equals("b")) {
  178.             System.out.print("ANALYSIS: You enjoy physical activites");
  179.         }
  180.         else {
  181.             System.out.print("NA");
  182.         }
  183.     }
  184.     //if the answer is not valid
  185.     public void input_error() {
  186.         System.out.println("Not a valid input" + "Try taking the quiz again. Read the questions carefully!");
  187.         introduction();
  188.     }
  189.     //main method
  190.     public static void main(String[] args) {
  191.         AdventureProjectt run = new AdventureProjectt();
  192.         run.introduction();
  193.     }
  194. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top