Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class StarWars {
- public static void main (String []args) {
- String a,b,c,d;
- String choice;
- String help;
- int count = 0;
- int user;
- int [] aud=new int[4];
- int exit;
- int name;
- String ans;
- int Ll1,Ll2;
- int totalwage;
- int friend = 1;
- int audience = 1;
- int Raud;
- int fiftyfifty = 1;
- int Ffty1,Ffty2;
- String yesno;
- String Fyesno;
- String Ayesno;
- String in1,in2;
- String [] words=new String[4];
- //intializing my varibles
- Scanner in = new Scanner (System.in);
- int [] wageArray = {100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000,
- 200000, 500000, 1000000, 2000000, 5000000};
- //storing points for the given questions
- String [] quesArray = new String [16];
- quesArray [1] = "Who is small, green and uses a cane to move around? ";
- quesArray [2] = "When was the first star wars movie made?";
- quesArray [3] = "What was order 66? ";
- quesArray [4] = "Who is R2 – D2s best friend? ";
- quesArray [5] = "What planet did the rebel base originally hide on in Empire strikes back? ";
- quesArray [6] = " Which Army did the Rebellion struggle to fight in the movie The last Jedi?";
- quesArray [7] = " What is the force?";
- quesArray [8] = " How many times did the Reblion achieve in destroying the dark sides heavy weaponary?";
- quesArray [9] = "What is the reason for the fall of the Jedi order ";
- quesArray [10] = "What was the reason behind Luke Skywalker being in Exile? ";
- quesArray [11] = "Which company owns Star Wars? ";
- quesArray [12] = "Which major actor died in the making of star wars the Last Jedi? ";
- quesArray [13] = "Who was the bounty hunter that was hunted down Han solo, captured him and gave him to Jabba the hutt ? ";
- quesArray [14] = "Who is the creator of Star wars or Lucasfilms?";
- quesArray [15] = "In sequential order, how is the Star Wars movies supposed to be Showcased?(refers to only the first 6 movies) ";
- String [] choArray = new String [59];
- choArray[1] = " a. Yoda b. R2-D2 c. Papa Smurf d. The Grinch // ";
- choArray[2] =" a. 1977 b. 1983 c. 2005 d. 1999 ";
- choArray[3] =" a. New Beginning of Jedi order b. Jedi slaughter c. Ending of the War d. Ending the Jedi order // ";
- choArray[4] =" a. BB8 b. C3PO c. Han Solo d. Obi-Wan-Kenobi // ";
- choArray[5] =" a. Yavin 4 b. Corusaunt c. Hoth d. Dagobah //";
- choArray[6] =" a. The Galactic Empire b. The Clone Army c. The Droid Federation d. The First Order //";
- choArray[7] =" a. Energy that flows and balances light and dark b. Moving rocks and pushing people //";
- choArray[8] =" a. 4 b. 3 c. 6 d. 2 //";
- choArray[9] =" a. Democracy B. Betrayal //";
- choArray[10] =" a. Took blame for training a new era of Jedi b. took blame for not training the new era of Jedi\n"
- + " c. Running away from the war d. Getting old // ";
- choArray[11] =" a. Warner Bros b. Marvel c. Dc Comics d. Lucasfilm // ";
- choArray[12] =" a. Carrie Fisher b. Harrison Ford c. Mark Hamill d. Peter Mayhew //";
- choArray[13] =" a. Jango Fett b. Boba Fett c. Ig 88 d. Jabba The Hutt // ";
- choArray[14] =" a. J.R.R Tolkien d. George Lucas c. Goerge Lucas d. J.J Abrams // ";
- choArray[15] =" a. A new hope, Empire Strikes back, The Return of the Jedi, Phantom Menance, Attack of the clones\n"
- + "Revenge of the sith"
- + "b. New hope, Revenge of the sith, Attack of the clones, Phantom menace, Return of the Jedi, Empire strikes back\n "
- + "c. New hope, Revenge of the sith, Empire strikes back, Return of the Jedi, Phantom menace, Attack of the clones ";
- String [] ansArray = new String [16];
- ansArray[1] = "a";
- ansArray[2] = "a";
- ansArray[3] = "d";
- ansArray[4] = "b";
- ansArray[5] = "c";
- ansArray[6] = "d";
- ansArray[7] = "a";
- ansArray[8] = "a";
- ansArray[9] = "b";
- ansArray[10] = "a";
- ansArray[11] = "d";
- ansArray[12] = "a";
- ansArray[13] = "b";
- ansArray[14] = "b";
- ansArray[15] = "a" ;
- //storing the correct answers to the given questions
- String [] helpArray = new String [1];
- System.out.print("Rules are Ez, answer the question and win the game\n"
- + "All you need to do is answer the question and hope you win\n");
- System.out.print("==============================================================");
- //using for loop so it repeats my code
- /*for ( int i = 0; i < quesArray.length; i++){
- System.out.println("\n" +quesArray[i+1]);
- System.out.println(choArray[i+1]);
- choice = in.nextLine();
- if (choice.equals (ansArray[i+1])){
- // as the user prints out the answer, the wage thats stored in the array will print out
- System.out.print(" ");
- System.out.print(wageArray[i+1]);
- } else {
- System.out.println("Game Over, plz try again next time");
- break;
- }
- }*/
- /* while ( fiftyfifty == true && friend == true && audience == true){
- while (!help.equalsIgnoreCase ("50:50")) && (!help.equalsIgnoreCase ("Friend")) && (!help.equalsIgnoreCase ("Ask the Audience")) && (!help.equalsIgnoreCase ("2"))){
- System.out.print("Try again");
- help = in.nextLine();
- }
- if (help.equals ("1. 50/50")){
- if (fiftyfifty == false){
- System.out.print("You have "+ (quesArray));
- fiftyfifty = true;
- System.out.print("Want another lifeline ? (If not type no to continue)");
- help=in.nextLine();
- }else {
- System.out.print("This lifeline has been used already, you can continue without help or use help");
- help = in.nextLine();
- }
- }else if (help ==("Friend")){
- if (friend == false){
- System.out.print("Friends name : ");
- name = in.nextInt();
- System.out.print(name + "thinks that this is the right answer");
- friend = true;
- System.out.print("another lifeline or would you like to continue? ( type no to proceed)");
- help = in.nextLine();
- }
- }else if (help ==("Audience helps")){
- int audArray;
- if (audience == false ){
- System.out.print("They believe that is is " + audArray + " . ");
- help = in.nextLine();
- System.out.print("this one has been used already, please pick another one or continue the game ( type yes\n"
- + "to procced ");
- help = in.nextLine();
- }else if (help.equals("2")){
- break;
- }
- }
- */
- while (true){
- in1 = in.nextLine();
- if (in1.equalsIgnoreCase ("a") || in1.equalsIgnoreCase( "b") || in1.equalsIgnoreCase ("c") || in1.equalsIgnoreCase ("d")) {//if they want a,b,c, or d
- if (in1.equalsIgnoreCase(ans)){//if the answer is correct
- System.out.println ("Correct!");
- }else {//the 3 wrong options
- System.out.println ("Incorrect");
- }
- break;
- } else if (in1.equals("1")) {//this lifeline has 80% chance of being correct, if it picks a wrong one it is incorrect
- if (Ll1==1){//
- Ll2 = (int)(Math.random() * 5) +1;
- System.out.println ("Guest:");
- if (Ll2 >=2) {
- System.out.println ("I think the answer is "+ans);
- }else {
- if (ans.equals("A")){
- Ll2 = (int)(Math.random() * 3) +1;
- if (Ll2==1){
- System.out.println ("answer is b");
- }else if (Ll2==2){
- System.out.println ("It's c");
- }else if (Ll2==3){
- System.out.println ("It'sd");
- }
- } else if (ans.equals("b")){
- Ll2 = (int)(Math.random() * 3) +1;
- System.out.print("It's a");
- }
- } else if (ans.equals("c")){
- Ll2 = (int)(Math.random() * 3) +1;
- if (Ll2==1){
- }
- }
- } else if (ans.equals("D")){
- Ll2 = (int)(Math.random() * 3) +1;
- if (Ll2==1){
- System.out.println ("I think the answer is A");
- }else if (Ll2==2){
- System.out.println ("I think the answer is B");
- }else if (Ll2==3){
- System.out.println ("I think the answer is C");
- }
- }
- }
- Ll1=0;
- System.out.println ("You have already used this lifeline");
- if (in1.equals("2")) {//This lifeline outputs 2 final options, the correct one and one incorrect answer
- if (fiftyfifty==1) {
- if (ans.equalsIgnoreCase("A")){
- Ffty2=0;
- Ffty1 = (int)(Math.random() * 3) +1;
- } else if (ans.equalsIgnoreCase("B")){
- Ffty2=1;
- Ffty1 = (int)(Math.random() * 4);
- if (Ffty1==Ffty2){
- while (Ffty1==Ffty2){
- Ffty1 = (int)(Math.random() * 4);
- }
- }
- } else if (ans.equalsIgnoreCase("C")){
- Ffty2=2;
- Ffty1 = (int)(Math.random() * 4);
- if (Ffty1==Ffty2){
- while (Ffty1==Ffty2){
- Ffty1 = (int)(Math.random() * 4);
- }
- }
- } else if (ans.equalsIgnoreCase("D")){
- Ffty2=3;
- Ffty1 = (int)(Math.random() * 3);
- }
- if (Ffty2>Ffty1){
- System.out.println(quesArray);
- System.out.println(words[Ffty1]);
- System.out.println(words[Ffty2]);
- } else if (Ffty1>Ffty2){
- System.out.println(quesArray);
- System.out.println(words[Ffty2]);
- System.out.println(words[Ffty1]);
- }
- fiftyfifty=0;
- }else {
- System.out.println("You have already used this lifeline");
- }
- } else if (in1.equals("3")){//this lifeline is completely random and has no positive effect on the user's choices
- if (audience==1){
- while (aud[0]+aud[1]+aud[2]+aud[3]<100){
- Raud = (int)(Math.random() * 4);
- aud[Raud]+=1;
- }
- for (int i=0;i<=3;i+=1){
- System.out.print(aud[i] +"% of the audience voted for ");
- if (i==0){
- System.out.println ("A");
- }else if (i==1){
- System.out.println ("B");
- }else if (i==2){
- System.out.println ("C");
- }else if (i==3){
- System.out.println ("D");
- }
- audience=0;
- }
- } else {
- System.out.println("You have already used this lifeline");
- }
- }else{ //if the user inputs anything other than a,b,c,d,1,2,or 3
- System.out.println ("Invalid");
- }
- break;
- while (true) {
- in2=in.nextLine();
- if (in1.equalsIgnoreCase("yes")){
- break;
- }else if (in1.equalsIgnoreCase("no")){
- break;
- }else{
- System.out.println("Invalid");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment