Assignemnt Choose Your Own Adventure
Code
/// Name: Ryan Volko
/// Period: 7
/// Program Name: project1
/// File Name: Project1.java
/// Date Finished: 12/1/2015
import java.util.Scanner;
class Project1{
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
String a, s, d, f, g, h, j, x, y, z;
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println(" Welcome to Ryan's Adventure");
System.out.println("Let's have some fun");
System.out.println("You are choosing a career what do you want to be (doctor or cowboy or astronaut)");
System.out.print("> ");
a = keyboard.next();
System.out.println("");
if (a.equals("doctor"))
{
System.out.println("would you like to be a (surgeon or general_practitioner)");
System.out.print("> ");
s = keyboard.next();
System.out.println("");
if (s.equals("surgeon"))
{
System.out.println("on your first day the mafia come in with a bleeding memeber and you stich him up the mafia boss proceeds to ask you to join their ranks as a doctor do you accept (yes or no)");
System.out.print("> ");
d = keyboard.next();
System.out.println("");
if ( d.equals("yes"))
{
System.out.println("You join the ranks but when you've had enough you escape and live on the run and in fear for the rest of your life!");
}
else if (d.equals("no"))
{
System.out.println("They kill you where you stand because you've seen their faces!");
}
}
else if (s.equals("general_practitioner"))
{
System.out.println("Do you plan on being a mean boss or a nice on to your surgeons (mean or nice)");
System.out.print("> ");
j = keyboard.next();
System.out.println("");
if (j.equals("mean"))
{
System.out.println("The surgeons in the hospital all hate you but the hospitals death rate is down!");
}
else if (j.equals("nice"))
{
System.out.println("The surgeons like you but since they arent getting better a patient dies.");
}
}
}
else if (a.equals("cowboy"))
{
System.out.println("Do you want to live in (texas or montana)");
System.out.print("> ");
f = keyboard.next();
System.out.println("");
if (f.equals("texas"))
{
System.out.println(" Your first week you lose the cattle so should you (find_them or tell_boss).");
System.out.print("> ");
g = keyboard.next();
System.out.println("");
if (g.equals("find_them"))
{
System.out.println("You find them but they were taken by a gang of theives and you get taken prisoner.");
}
else if (g.equals("tell_boss"))
{
System.out.println("Your boss fires you but you soon realize your true dream is accountant so you are happy.");
}
}
else if (f.equals("montana"))
{
System.out.println("When you arrive its winter and a record cold do you (stay or go)");
System.out.print("> ");
h = keyboard.next();
System.out.println("");
if (h.equals("stay"))
{
System.out.println("all your cattle die and you barely survive only to lose all your money and live on the streets.");
}
else if (h.equals("go"))
{
System.out.println("You leave and come home to no money or no job and are forced to move into your mother's house.");
}
if (a.equals("astronaunt"))
{
System.out.println("would you like to go to (mars or moon)");
System.out.print("> ");
x = keyboard.next();
System.out.println("");
if (x.equals("moon"))
{
System.out.println("As your shuttle approaches the moon do you want to go to the surface or stay in the shuttle (surface or shuttle)");
System.out.print("> ");
y = keyboard.next();
System.out.println("");
if ( y.equals("surface"))
{
System.out.println("you become part of an elite club of people to walk on the moon!");
}
else if (y.equals("shuttle"))
{
System.out.println("The pod to get to the surface fails but since you stayed on the shuttle you were able to save it by sending a hook to catch the pod!");
}
}
else if (x.equals("mars"))
{
System.out.println("As your shuttle approaches the mars do you want to go to the surface or stay in the shuttle (surface or shuttle)");
System.out.print("> ");
z = keyboard.next();
System.out.println("");
if (z.equals("surface"))
{
System.out.println("Your suit rips and you die from lack of oxygen!");
}
else if (z.equals("shuttle"))
{
System.out.println("You miss out on being the first person to step on mars and regret it your whole life.");
}
}
}
}
}
else
{
System.out.println("You didn't play the game so you died.");
}
System.out.println("");
System.out.println("Thanks for playing");
}
}
Picture of the output