// The "ChoseYourOwnStory" class.
import java.awt.*;
import hsa.Console;

public class ChoseYourOwnStory
{
    static Console c;           // The output console

    public static void main (String[] args)
    {
        c = new Console ();

        String start = ("yes");


        // assignment 1
        while (start.equals ("yes"))
        {
            c.println ("A high ranking thug comes walking towards you. He is dressed in dark brown pants");
            c.println ("and a black hoodie. His hoodie is barely covering the ancient scars on his face.");
            c.println ("He is wearing old shoes and his bid toe is poking out of the hole in the ");
            c.println ("front. he approaches you calmly. He says, \" I have another assignment for you.\" ");
            String assignment;
            c.println ();
            c.setTextColor (Color.red);
            c.print ("Do you take the assignment? (yes/no) ");
            assignment = c.readLine ();

            if (assignment.equals ("yes"))
            { // the error is   "}" inserted to complete StatementNoShortIf but the bracket is closed.
                c.setTextColor (Color.black);
                c.println ();
                c.print ("He pulls out 3 envelopes and says \"Choose one\"");                 // chose envelope
                int envelope;
                c.println ();
                c.setTextColor (Color.red);
                c.print ("Chose which envelope you want (1, 2 or 3)");
                envelope = c.readInt ();                                  // gets user input
                c.setTextColor (Color.black);
                if (envelope == 1)
                { // opens envelope 1
                    c.println ("You take envelope 1 and open it. It reads, You have selected envelope 1.");
                    c.println ("You know the drill by now");
                    c.println ();

                    c.println ("Destination: Ottawa");
                    c.println ("Time: 13:00");
                    c.println ();
                    c.println ("Your plane ticket has been included in the envelope. Good luck.");  // prints envelope 1
                    c.println ("There is no turning back now!");
                    c.println ();
                    c.println ("A couple minutes later you are driving towards the airport.");                         // airport
                    c.println ("You arrive a few minutes later. While going through security you");
                    c.println ("happen to set off the metal detector. The officer asks \"do you have anything  ");
                    c.println ("metal on you?\"");
                    c.setTextColor (Color.red);
                    c.print ("You answer: (type 'yes'for yes, 'no' for no and 'run' to run away)");
                    String answer;
                    answer = c.readLine ();               // gets answer from user
                    if (answer.equals ("yes"))
                    { // read yes if answer yes
                        c.setTextColor (Color.black);
                        c.println ("You hand over your watch to the officer. He prompts you to go through the ");
                        c.println ("detector again. You go through the machine and it beeps again. The officer ");
                        c.println ("searches you and finds nothing. After your time with the officer you board ");
                        c.println ("the plane. The plane takes off. \" Seven hours flight time remaining\", ");
                        c.println ("announces the loud speaker. You slowly drift off into a deep sleep. ");
                        c.println ("");
                        c.println ("You wake up 7 hours later. The speaker announces that the plane will ");                // on plane
                        c.println ("be landing immediately. You sit back in your seat and wait to land");
                        c.println ("Slowly you get off the plane and go to your hotel.");
                        c.println ("");
                        c.println ("You realize you are behind schedule. You grab your bag and run out the door.");
                        c.println ("You notice that people are looking at you suspiciously. You ignore them");
                        c.println ("and continue running. by the time you get to your destination it is raining.");
                        c.setTextColor (Color.red);
                        c.print ("Do you want to set up a shelter? (yes/no)");               // asks user a question
                        c.setTextColor (Color.black);
                        String shelter;
                        shelter = c.readLine ();     // gets answer
                        if (shelter.equals ("yes"))
                        {
                            c.println ("You set up your shelter. By this time you need to hurry up.");
                            c.println ("You grab something from your bag.");
                            c.setTextColor (Color.red);
                            c.print ("Type 1, 2 or 3 to select which item you grab.");                         // asks user a question
                            c.setTextColor (Color.black);
                            int item = c.readInt ();                                                           // gets answer
                            if (item == 1)
                            { // wep 1
                                c.println ("You run to the ledge, take aim and you try to fire your orange at");
                                c.println ("Stephen Harper. The police immediately come and arrest you for ");
                                c.println ("attemped murder. You spend the rest of your days in a misserable");
                                c.println ("jail.");
                            }
                            else if (item == 2)
                            { // wep 2
                                c.println ("You run to the ledge, take aim and fire your flamethrower at");
                                c.println ("Stephen Harper. The appartment immediately catches on fire. ");
                                c.println ("You try to doust the flames but the shelter you set up protects");
                                c.println ("the flames from the rain. You burn to death on that day, never ");
                                c.println ("to be seen again.");
                            }
                            else if (item == 3)
                            { //wep 3
                                c.println ("You run to the ledge, take aim and before you even shot Stephen ");
                                c.println ("Harper falls to the ground. You are wondering what just happened.");
                                c.println ("Yuou see the medics come in and you hear them announce that he had");
                                c.println ("a heart attack and died, they tell you that it was because off all");
                                c.println ("of the McDonalds fries that he had. You accomplished your mission.");
                            }

                        }

                        else if (shelter.equals ("no"))
                        { // reads no if answer no
                            c.println ("You decide not to set up a shelter. You are soaking wet. Your clothes");
                            c.println ("weigh you down. you need to chose your weapon quickly.");
                            c.setTextColor (Color.red);
                            c.println ("Do you choose the small (small), medium (med), or the largest (large) weapon?");  // asks user a question
                            String wep = c.readLine ();                                                                 // gets user input
                            c.setTextColor (Color.black);
                            if (wep.equals ("small"))
                            { // compares user answer to given requirement
                                c.println ("You run to the ledge, take aim and you fire your pistol at");
                                c.println ("Stephen Harper. Stephen Harper drops dead in the middle of question ");
                                c.println ("period. All the other politicians thought that he deserved it for being");
                                c.println ("on his blackberry. They call off the police search and you live to kill");
                                c.println ("another day.");
                            }
                            if (wep.equals ("med"))
                            { // compares user answer to given requirement
                                c.println ("You run to the ledge, take aim and you fire your sniper at");
                                c.println ("Stephen Harper. Stephen Harper drops dead in the middle of question ");
                                c.println ("period. Everyone wonders what happened to him, but really no one cares.");
                                c.println ("They decide the world has been rid of one evil and they are greatful.");
                                c.println ("The assassin is considered a great hero until his karma turned against him.");
                            }
                            if (wep.equals ("large"))
                            { // compares user answer to given requirement
                                c.println ("You run to the ledge, take aim and you fire your rocket at");
                                c.println ("Stephen Harper. The parlament explodes. You are featured on America's ");
                                c.println ("Most Wanted and you spend the rest of your life in a sewer living off the");
                                c.println ("rats until disease takes your life.");

                            }

                        }

                        else if (answer.equals ("no"))
                        { // plane  //no reads if answer is no
                            c.println ("The officer ");
                            c.println ("searches you and finds nothing. After your time with the officer you board ");
                            c.println ("the plane. The plane takes off. \" Seven hours flight time remaining\", ");
                            c.println ("announces the loud speaker. You slowly drift off into a deep sleep. ");
                            c.println ("");
                            c.println ("You wake up 7 hours later. The speaker announces that the plane will ");
                            c.println ("be landing immediately. You sit back in your seat and wait to land");
                            c.println ("Slowly you get off the plane and go to your hotel.");
                            c.println ("");
                            c.println ("You realize you are behind schedule. You grab your bag and run out the door.");
                            c.println ("You notice that people are looking at you suspiciously. You ignore them");
                            c.println ("and continue running. by the time you get to your destination it is raining.");
                            c.setTextColor (Color.red);
                            c.print ("Do you want to set up a shelter? (yes/no)");                           // aksk user a question
                            c.setTextColor (Color.black);

                            shelter = c.readLine ();                                           // gets user input
                            c.setTextColor (Color.black);
                            if (shelter.equals ("yes"))
                            {
                                c.println ("You set up your shelter. By this time you need to hurry up.");
                                c.println ("You grab something from your bag.");
                                c.setTextColor (Color.red);
                                c.print ("Type 1, 2 or 3 to select which item you grab.");              // asks user a question
                                c.setTextColor (Color.black);
                                int item = c.readInt ();                                                // gets user input
                                if (item == 1)
                                { // item 1
                                    c.println ("You run to the ledge, take aim and you try to fire your orange at");
                                    c.println ("Stephen Harper. The police immediately come and arrest you for ");
                                    c.println ("attemped murder. You spend the rest of your days in a misserable");
                                    c.println ("jail.");
                                }
                                else if (item == 2)
                                { // item 2
                                    c.println ("You run to the ledge, take aim and fire your flamethrower at");
                                    c.println ("Stephen Harper. The appartment immediately catches on fire. ");
                                    c.println ("You try to doust the flames but the shelter you set up protects");
                                    c.println ("the flames from the rain. You burn to death on that day, never ");
                                    c.println ("to be seen again.");
                                }
                                else if (item == 3)
                                { // item 3
                                    c.println ("You run to the ledge, take aim and before you even shot Stephen ");
                                    c.println ("Harper falls to the ground. You are wondering what just happened.");
                                    c.println ("You see the medics come in and you hear them announce that he had");
                                    c.println ("a heart attack and died, they tell you that it was because off all");
                                    c.println ("of the McDonalds fries that he had. You accomplished your mission.");
                                }
                            }
                            else if (shelter.equals ("no"))
                            { // no shelter
                                c.println ("You decide not to set up a shelter. You are soaking wet. Your clothes");
                                c.println ("weigh you down. you need to chose your weapon quickly.");
                                c.setTextColor (Color.red);
                                c.println ("Do you choose the small (small), medium (med), or the largest (large) weapon?"); // asks user a question
                                String wep = c.readLine ();                                                                 // gets user input
                                c.setTextColor (Color.black);
                                if (wep.equals ("small"))
                                { // compares answer to option
                                    c.println ("You run to the ledge, take aim and you fire your pistol at");
                                    c.println ("Stephen Harper. Stephen Harper drops dead in the middle of question ");
                                    c.println ("period. All the other politicians thought that he deserved it for being");
                                    c.println ("on his blackberry. They call off the police search and you live to kill");
                                    c.println ("another day.");
                                }
                                if (wep.equals ("med"))
                                { // compares answer to option
                                    c.println ("You run to the ledge, take aim and you fire your sniper at");
                                    c.println ("Stephen Harper. Stephen Harper drops dead in the middle of question ");
                                    c.println ("period. Everyone wonders what happened to him, but really no one cares.");
                                    c.println ("They decide the world has been rid of one evil and they are greatful.");
                                    c.println ("The assassin is considered a great hero until his karma turned against him.");
                                }
                                if (wep.equals ("large"))
                                { // compares answer to option
                                    c.println ("You run to the ledge, take aim and you fire your rocket at");
                                    c.println ("Stephen Harper. The parlament explodes. You are featured on America's ");
                                    c.println ("Most Wanted and you spend the rest of your life in a sewer living off the");
                                    c.println ("rats until disease takes your life.");

                                }

                            }
                        }
                        else if (answer.equals ("run"))
                        { // run from cops
                            c.println ("You start to run. The cops immediately chase you down and arrest you.");
                            c.println ("You are tortured until you speak.");
                            c.setTextColor (Color.red);
                            c.println ("Do you speak? (yes/no) ");                                          // asks user a question
                            String speak = c.readLine ();                                                   // gets user input
                            c.setTextColor (Color.black);
                            if (speak.equals ("yes"))
                            { // compares answer to option
                                c.println ("You tell the cops everything. You tell them you're a ninja going to kill");
                                c.println ("Stephen Harper. They dont believe you but they arrest you anyway for ");
                                c.println ("safety purposes");
                            }

                            else if (speak.equals ("no"))
                            { // compares answer to option
                                c.println ("You do not budge. The cops torture you. They rip off parts of your body.");
                                c.println ("You still dont speak. They torture you until you die. You will never be remembered.");
                                c.println ("The cops and government cover up the whole story.");
                            }
                        }
                    }
                } // end envelope 1
                else if (envelope == 2)
                {
                    c.println ("You take envelope 2 and open it. It reads, You have selected envelope 1.");
                    c.println ("You know the drill by now");
                    c.println ();
                    c.println ("Destination: Ontario");
                    c.println ("Time: 10:30");
                    c.println ();
                    c.println ("Your plane ticket has been included in the envelope. Good luck.");
                    c.println ("There is no turning back now!");
                    c.println ();
                    c.println ("A couple minutes later you are driving towards the airport.");
                    c.println ("You arrive a few minutes later. While going through security you");
                    c.println ("happen to set off the metal detector. The officer asks \"do you have anything  ");
                    c.println ("metal on you?\"");
                    c.setTextColor (Color.red);
                    c.print ("You answer: (type 'yes'for yes, 'no' for no and 'run' to run away)");
                    String answer;
                    answer = c.readLine ();
                    if (answer.equals ("yes"))
                    {
                        c.setTextColor (Color.black);
                        c.println ("You hand over a sowing kit to the officer. He prompts you to go through the ");
                        c.println ("detector again. You go through the machine and it does not beep. ");
                        c.println ("After going through security you get on the plane. ");
                        c.println ("The plane takes off. \" six and a half  hours flight time remaining\", ");
                        c.println ("announces the loud speaker. You carefully plan out the events to come. ");
                        c.println ("");
                        c.println ("6 1/2 hours later all the plans are perfected. The speaker announces that the plane will ");
                        c.println ("be landing immediately and that the weather is hot and dry. You sit back in your seat ");
                        c.println ("and wait to land. Slowly you get off the plane and go a small place to eat.");
                        c.println ("");
                        c.println ("You realize you are behind schedule. You grab your bag and run out the door.");
                        c.println ("You quickly run across the road jump over a couple of cars and creep into the building.");
                        c.println ("You climb up the stairs. Good! The door is open.");
                        c.println ("You grab something from your bag.");
                        c.setTextColor (Color.red);
                        c.print ("Type 1, 2 or 3 to select which item you grab.");
                        c.setTextColor (Color.black);
                        int item = c.readInt ();
                        if (item == 1)
                        {
                            c.println ("You grab a fork out of your bag. You turn the corner and throw the fork");
                            c.println ("into the classroom. It hits Jordan Lemcke in the back of the head. ");
                            c.println ("The supply teacher who sees the fork in his head quickly runs over and rips");
                            c.println ("the fork out. Jordan by now has massive blood loss and dies of it.");
                            c.println ("The supply teacher takes the blame for not being able to control his");
                            c.println ("anger. The School Board realizes that he did not have first aid training ");
                            c.println ("and they fire him.");
                        }
                        else if (item == 2)
                        {
                            c.println ("You grab the first two big things that you can find.");
                            c.println ("You look in the door, pull the bow back and fire the arrow. ");
                            c.println ("it soars through the air and sticks into the wall above your targets head.");
                            c.println ("the teacher sreams for help and calls the police. They come and arrest you.");
                            c.println ("You spend the rest of your days in a jail.");
                        }
                        else if (item == 3)
                        {
                            c.println ("You take out the smallest but one of the best things from your bag.");
                            c.println ("You put the blowdart to your mouth. You turn the corner and fire the dart.");
                            c.println ("The small dart tipped in posion flies through the air. Unfortunately the fan");
                            c.println ("was on it is blew the dart over a bit. Instead of hitting Jordan you hit the ");
                            c.println ("person two to the right of him. Nik drops on the floor dead and you run away.");
                        }
                    }
                    else if (answer.equals ("no"))
                    {
                        c.println ("After going through security you get on the plane. ");
                        c.println ("The plane takes off. \" six and a half  hours flight time remaining\", ");
                        c.println ("announces the loud speaker. You carefully plan out the events to come. ");
                        c.println ("");
                        c.println ("6 1/2 hours later all the plans are perfected. The speaker announces that the plane will ");
                        c.println ("be landing immediately and that the weather is hot and dry. You sit back in your seat ");
                        c.println ("and wait to land. Slowly you get off the plane and go a small place to eat.");
                        c.println ("");
                        c.println ("You realize you are behind schedule. You grab your bag and run out the door.");
                        c.println ("You quickly run across the road jump over a couple of cars and creep into the building.");
                        c.println ("You climb up the stairs. Good! The door is open.");
                        c.println ("You grab something from your bag.");
                        String wep = c.readLine ();
                        c.setTextColor (Color.black);
                        if (wep.equals ("small"))
                        {
                            c.println ("You run to the ledge, take aim and you fire your pistol at");
                            c.println ("Stephen Harper. Stephen Harper drops dead in the middle of question ");
                            c.println ("period. All the other politicians thought that he deserved it for being");
                            c.println ("on his blackberry. They call off the police search and you live to kill");
                            c.println ("another day.");
                        }
                        if (wep.equals ("med"))
                        {
                            c.println ("You run to the ledge, take aim and you fire your sniper at");
                            c.println ("Stephen Harper. Stephen Harper drops dead in the middle of question ");
                            c.println ("period. Everyone wonders what happened to him, but really no one cares.");
                            c.println ("They decide the world has been rid of one evil and they are greatful.");
                            c.println ("The assassin is considered a great hero until his karma turned against him.");
                        }
                        if (wep.equals ("large"))
                        {
                            c.println ("You run to the ledge, take aim and you fire your rocket at");
                            c.println ("Stephen Harper. The parlament explodes. You are featured on America's ");
                            c.println ("Most Wanted and you spend the rest of your life in a sewer living off the");
                            c.println ("rats until disease takes your life.");

                        }
                    }
                    else if (answer.equals ("run"))
                    {
                        c.println ("You start to run. The cops immediately chase you down and arrest you.");
                        c.println ("You are tortured until you speak.");
                        c.setTextColor (Color.red);
                        c.println ("Do you speak? (yes/no) ");
                        String speak = c.readLine ();
                        c.setTextColor (Color.black);
                        if (speak.equals ("yes"))
                        {
                            c.println ("You tell the cops everything. You tell them you're a ninja going to kill");
                            c.println ("Jordan Lemcke. They dont believe you but they arrest you anyway for ");
                            c.println ("safety purposes");
                        }

                        else if (speak.equals ("no"))
                        {
                            c.println ("You do not budge. The cops torture you. They rip off parts of your body.");
                            c.println ("You still dont speak. They torture you until you die. You will never be ");
                            c.println ("remembered. The cops and government cover up the whole story.");
                        }
                    }
                }
                String answer;
                else if (envelope == 3)
                {

                    c.println ("You take envelope 1 and open it. It reads, You have selected envelope 1.");
                    c.println ("You know the drill by now");
                    c.println ();

                    c.println ("Destination: Home");
                    c.println ("Time: 10:00");
                    c.println ();
                    c.println ("Good luck.");  // prints envelope 1
                    c.println ("There is no turning back now!");
                    c.println ();
                    c.println ("You drive to a famous sushi bar. you are carrying a lightly packed bag.");
                    c.println ("You are dressed in dark clothes.");
                    c.println ("You get out of the car. Someone is blocking your way. ");
                    c.setTextColor (Color.red);
                    c.print ("Do you go around them (round) or push them (push) out of the way?");
                    c.setTextColor (Color.black);
                    answer = c.readLine ();
                    if (answer.equals ("round"))
                    { // read yes if answer yes


                        c.print ("you speed around the person. You get to the sushi bar in time.");
                        c.println ("You see your target."); // asks user a question
                        c.setTextColor (Color.black);
                        c.setTextColor (Color.red);
                        c.print ("Type 1 to go in stealth, 2 to go in ninja or 3 to use your skills.");
                        int move = c.readInt ();                                            // gets answer

                        if (move == 1)
                        {


                            c.println ("You sneak in behind George bush and kill him. No one notices until");
                            c.println ("he doesn't answer when they ask him if he died.");
                            c.println ("You live your life happily knowing that you helped the world.");
                        }
                        else if (move == 2)
                        { // reads no if answer no
                            c.println ("You have decided to go in ninja. You try to kill George Bush");
                            c.println ("but his body guard spot you. You try to run away but the sumo's");
                            c.println ("block your escape. His bodyguars tackle you and send you to jail.");
                            c.println ("You lay in your cold cell for the rest of your days.");
                        }
                        else if (move == 3)
                        {
                            c.println ("You send an electrical shockwave through the air. George Bush");
                            c.println ("has a massive heart attack. no one knows who caused it. You get away");
                            c.println ("safely.");

                        }


                    }
                    else if (answer.equals ("push"))
                    { // plane  //no reads if answer is no
                        c.print ("You push the person out off your way. He has anger management and beats");
                        c.println ("you up. you spend the rest of your days in the hospital.");


                    }
                }

            }

            if (assignment.equals ("no"))
            {
                c.println ("He pulls out a gun and says \"Take the assignment or die.\"  ");
                c.setTextColor (Color.red);
                c.println ("");
                c.println ("Do you take the assignment? (y/n)");
                String ynassignment = c.readLine ();
                c.setTextColor (Color.black);
                if (ynassignment.equals ("y"))
                {



                }


            }
















            // Place your program here.  'c' is the output console
        } // main method
    } // ChoseYourOwnStory class

thanks for the help

Recommended Answers

All 4 Replies

Use a good code editor to help you find where your bracket error is. And please use the code tags next time you post code.

The problem as i see it is that just before the else selection statment for envelop == 3 you have closed the previouse else if block but then got string answer;, try commenting it out and see if the error disapears, if so you need to look at where that statement should be placed. Hope it helps, will keep looking for anything else.

Use a good code editor to help you find where your bracket error is. And please use the code tags next time you post code.

I do use the code tags

It looks like you used the Quote tags, not the Code tags. The Code tags will put line numbers and do syntax highlighting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.