Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Hend Al-Zeer
- * Help from Mr. David
- * adventure project: Vogue Quiz
- */
- import java.util.Scanner;
- //defining string variables for the multiple inputs of the methods
- public class AdventureProjectt {
- private String seasonQuestionAns;
- private String lifestyleAns;
- private String snack;
- private String song;
- private String activity;
- private String phone;
- private Scanner input = new Scanner(System.in);
- //introduce game and get name
- public void introduction() {
- System.out.println("What is your name?");
- String answer = input.next();
- System.out.println("Welcome " + answer + "!" + "\n To \"Know Yourself Better\""
- + " vogue quiz! \r In this quiz an analysis will be given \r about your personality "
- + "based on \r your answers to a couple of random questions");
- System.out.println("Want to try it out? \r a.Yes \r b.No");
- String firstTry = input.next();
- if (firstTry.equals("a")) {
- firstQuestion();
- }
- else if (firstTry.equals("b")) {
- System.out.println("Why not? You are missing out!");
- }
- else {
- input_error();
- }
- }
- public void ending() {
- System.out.println("Thank you for taking this quiz! \r we hope it made you discover yourself \r more!");
- }
- //first question method that sends player to other methods based on answer
- public void firstQuestion() {
- System.out.println("Pick a letter: \r a.1 \r b.2");
- String answer = input.next();
- if (answer.equals("a")) {
- seasonQuestion();
- }
- else if (answer.equals("b")){
- lifestyleQuestion();
- }
- else {
- input_error();
- }
- }
- //if you answered a to first question to previous question, this method runs
- public void seasonQuestion() {
- System.out.println("What season do you prefer?\r Do you like the slow beat of the rain \r as it hits the ground"
- + " \r or do you prefer the active \r lifestyle granted to people \r in the summer? \r a. Winter \r b.Summer");
- seasonQuestionAns = input.next();
- seasonAns();
- if (seasonQuestionAns.equals("a")){
- middDaySnackQ();
- }
- else if (seasonQuestionAns.equals("b")) {
- phoneQ();
- }
- else {
- input_error();
- }
- }
- public void middDaySnackQ() {
- System.out.println("As a midday snack, what do you prefer? \r a. Melted Chocolate cake \r b. Popsicles");
- snack = input.next();
- snackAns();
- ending();
- }
- public void phoneQ() {
- System.out.println("What would you pick: \r a.Iphone \r b.Samsung");
- phone = input.next();
- phoneAns();
- ending();
- }
- //if you answered "b" to previous question, this method runs
- public void lifestyleQuestion() {
- System.out.println("If you had to pick between these two \r what would you pick? \r a. City lifestyle \r b. Countryside Lifestyle");
- lifestyleAns = input.next();
- lifeStyle();
- if (lifestyleAns.equals("a")) {
- musicQ();
- songAns();
- ending();
- }
- else if (lifestyleAns.equals("b")) {
- activityQ();
- activityAns();
- ending();
- }
- else {
- input_error();
- }
- }
- public void musicQ() {
- 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");
- song = input.next();
- }
- public void activityQ() {
- System.out.println("What would you prefer?\r a. movie night at home \r b.Spending a night at the stadium ");
- activity = input.next();
- }
- /* the following methods are an additional feature to the adventure game, it shows
- results that are previously saved and based on them prints out different conclusions */
- public void seasonAns() {
- if (seasonQuestionAns.equals("a")) {
- System.out.println("You prefer the cold and the soothing sound \r of the rain drops hitting the ground");
- }
- else if (seasonQuestionAns.equals("b")) {
- System.out.println("ANALYSIS: You prefer the active lifestyle granted by the summer. ");
- }
- else {
- System.out.print("NA");
- }
- }
- public void snackAns() {
- if (snack.equals("a")) {
- System.out.println("ANALYSIS: You have a sweet tooth");
- }
- else if (snack.equals("b")) {
- System.out.println("ANALYSIS: You enjoy the fresh taste of ice-cream!");
- }
- else {
- System.out.print("NA");
- }
- }
- public void phoneAns() {
- if (phone.equals("a")) {
- System.out.print("ANALYSIS: You are an asthetic person that likes \r to take asthetic pictures on their IPhone");
- }
- else if (phone.equals("b")) {
- System.out.print("ANALYSIS: You are a practical person that prefers practicality \r over looks by choosing Samsung.");
- }
- else {
- System.out.print("NA");
- }
- }
- public void lifeStyle() {
- if (lifestyleAns.equals("a")) {
- System.out.print("ANALYSIS: You enjoy the feeling of rush");
- }
- else if (lifestyleAns.equals("b")) {
- System.out.print("ANALYSIS: You are a calm person who enjoys the nature");
- }
- else {
- System.out.print("NA");
- }
- }
- public void songAns() {
- if (song.equals("a")) {
- System.out.print("ANALYSIS: You enjoy classics which portrays your wise, old-school personality");
- }
- else if (song.equals("b")) {
- System.out.print("ANALYSIS: You enjoy upbeat music which portrays your outgoing personality");
- }
- else {
- System.out.print("NA");
- }
- }
- public void activityAns() {
- if (activity.equals("a")) {
- System.out.print("ANALYSIS: You are a quiet person that favors quality time");
- }
- else if (activity.equals("b")) {
- System.out.print("ANALYSIS: You enjoy physical activites");
- }
- else {
- System.out.print("NA");
- }
- }
- //if the answer is not valid
- public void input_error() {
- System.out.println("Not a valid input" + "Try taking the quiz again. Read the questions carefully!");
- introduction();
- }
- //main method
- public static void main(String[] args) {
- AdventureProjectt run = new AdventureProjectt();
- run.introduction();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement