Assignment #45 and Choose Your Own Adventure!
Code
/// Name: Brendan Baird
/// Period: 6
/// Program Name: Choose Your Own Adventure!
/// File Name: ChooseAdventure.java
/// Date Finished: 10/9/2015
import java.util.Scanner;
public class ChooseAdventure
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
String r1, r2, r3, r4, r5, r6, r7;
System.out.println("WELCOME TO BRENDAN'S TINY ADVENTURE!");
System.out.println();
System.out.println("You are in school and late to class! Would you like to go to \"class\" or to the \"fountain\"?");
r1 = keyboard.next();
System.out.println();
if (r1.equals("class"))
{
System.out.println("You enter the classroom and the class stares at you. You may go to your \"seat\" or to your \"happy-place\".");
r2 = keyboard.next();
System.out.println();
if (r2.equals("seat"))
{
System.out.println("You sit down and the teacher resumes the lecture. Would you like to take notes? (\"yes\" or \"no\")");
r3 = keyboard.next();
System.out.println();
if (r3.equals("yes"))
{
System.out.println("You pass the class and become a doctor. Thank you for playing!");
}
else if (r3.equals("no"))
{
System.out.println("You fail the class and begin your career in retail. Thank you for playing!");
}
}
else if (r2.equals("happy-place"))
{
System.out.println("You enter a land of rainbows and unicorns. Would you like to conquer the land? (\"yes\" or \"no\")");
r4 = keyboard.next();
System.out.println();
if (r4.equals("yes"))
{
System.out.println("You build an empire and enslave the unicorns. Thank you for playing!");
}
else if (r4.equals("no"))
{
System.out.println("You frolic through the fields until realizing you can't exit your happy place, eventually becoming an ancient sage. Thank you for playing!");
}
}
}
else if (r1.equals("fountain"))
{
System.out.println("You coolly sip your water when you see an attractive girl. You may go and \"flirt\" or \"escape\" confrontation.");
r5 = keyboard.next();
System.out.println();
if (r5.equals("flirt"))
{
System.out.println("Your flirting attempts fail epically. Would you like to try again? (\"yes\" or \"no\")");
r6 = keyboard.next();
System.out.println();
if (r6.equals("yes"))
{
System.out.println("You are harshly rejected and you begin to write sad poems for when alone. Thank you for playing!");
}
else if (r6.equals("no"))
{
System.out.println("You find a better girl and become happily married. Thank you for playing!");
}
}
else if (r5.equals("escape"))
{
System.out.println("You find a locker glowing from inside. Would you like to open the locker? (\"yes\" or \"no\")");
r7 = keyboard.next();
System.out.println();
if (r7.equals("yes"))
{
System.out.println("You find a rave and show off your sweet moves. Thank you for playing!");
}
else if (r7.equals("no"))
{
System.out.println("You wander the school grounds until next period. Thank you for playing!");
}
}
}
}
}
Picture of the output