Breaking News

COMPLETE SOURCE CODE FOR BRAIN TEASER GAME IN JAVA

import java.util.Scanner;
public class Game {
public static void main(String[] args) {  
int choice;
double answer1=0;
double scoreA=25;
double scoreB=0.0;
double score1=0;
double score2=0;
double score3=0;

int counter1=0;
int counter2=0;
int counter3=0;
int counter4=0;
int counter5=0;
int counter6=0;
int counter7=0;
int counter8=0;


String answerA;
String [] names={"elephant","nicholaus","collage","eclipse"};
String [] player=new String [1];
  
Scanner b = new Scanner(System.in);


 do{
System.out.println( " WELCOME TO BRAIN CHALLENGE GAME");
System.out.println(" PLEASE ENTER YOUR NAME BELOW....");
    player[0]=b.nextLine();
System.out.println("           Hello.!!!" + " " + player[0]);
System.out.println("       THE GAME WILL HAVE TWO MODES FIRST IS MATHEMATICS QUESTIONS AND SECOND IS WORDS ARRANGEMENT.");
System.out.println("     ENTER 1 FOR MATHEMATICS OR ENTER 2 FOR WORDS ARRANGEMENT");

choice=b.nextInt();
 }while(choice<0 || choice>2);
   
     
    switch (choice){
    case 1:{
    System.out.println(" Hi"+" "+ player[0]+" GET READY FOR MATHEMATICAL GAME");
    System.out.println();
    System.out.println("INSTRUCTIONS:");
    System.out.println("1.THE GAME WILL CONSIST 4 QUESTIONS");
    System.out.println("2.REMEMBER YOU HAVE THREE ATTEMPTS IN EACH QUESTION");
     
    System.out.println();
     
       do{
     
        System.out.println("QUESTION 1");
        System.out.println("IF 15 X 3 = 12");
        System.out.println("   16 X 4 = 20");
        System.out.println("   17 X 5 = 30");
        System.out.println("   18 X 6 = 42");
        System.out.println("   19 X 7 = ???");
           answer1=b.nextDouble();
           if(answer1==56){
            System.out.println("good job..!!"); 
            System.out.println(" YOUR SCORE IS" + " " + scoreA);break;}
               counter1++;
       
            if(counter1==3){
        System.out.println("TOO MANY ATTEMPTS    GAME OVER");
        System.out.println(" YOUR  TOTAL SCORE IS" + " " + scoreB);break;}
           if(answer1!=56){
                 System.out.println("WRONG ANSWER TRY AGAIN");}
         }while(answer1!=56);
               if(answer1==56){  //end of qn 1
       
    System.out.println();
      do{
       
       System.out.println("QUESTION 2");
       System.out.println("     [??]");
       System.out.println("    [8][8]");
       System.out.println("  [2][4][2]");
       System.out.println(" [1][2][2][1]");
               score1=scoreA*2;
              answer1=b.nextDouble();
              if(answer1==64){
               System.out.println("exellent..!!");
               System.out.println("YOUR SCORE IS" + " " + score1);break;}
              counter2++;
   
          if(counter2==3){
          System.out.println("TOO MANY ATTEMPTS    GAME OVER");
          System.out.println(" YOUR TOTAL SCORE IS" + " "+ scoreA);break;}
          if(answer1!=64){
                System.out.println("WRONG ANSWER TRY AGAIN");}
     }while(answer1!=64);
           if(answer1==64){ //end of qn 2
      
      System.out.println();
      do{
      
          System.out.println("QUESTION 3");
          System.out.println("|6  |5  |12 |");
          System.out.println("|12 |15 |36 |");
          System.out.println("|36 |60 |144|");
          System.out.println("|144|300|???|");
              score2=scoreA*3;
              answer1=b.nextDouble();
          if(answer1==720){
    System.out.println("awesome...");
      System.out.println("YOUR SCORE IS" +" " + score2); break;}
                   counter3++;
                 
              if(counter3==3){
             System.out.println("TOO MANY ATTEMPTS    GAME OVER");
             System.out.println("YOUR TOTAL SCORE IS" + " "+ score1); break;}
              if(answer1!=720){
               System.out.println("WRONG ANSWER TRY AGAIN");}
           }while(answer1!=720);
             if(answer1==720){  //end of qn3 and level 1
          
       
            System.out.println();
            
            
        do{
                 System.out.println("QUESTION 4");
                 System.out.println("              (134)         ");
                 System.out.println("                |           ");
                 System.out.println("                |           ");
                 System.out.println("                |           ");
                 System.out.println(" (???)---------(5)----------(215)  ");
                 System.out.println("                |           ");
                 System.out.println("                |           ");
                 System.out.println("                |           ");
                 System.out.println("              (505)         ");
                 
                       score3=scoreA*4;
                    answer1=b.nextDouble();
                 if(answer1==1250){
                    System.out.println("awesome...");
                      System.out.println("           CONGRATULATION" + "  " + player[0] +" "+ "YOUR THE MIND MASTER");
                    System.out.println("YOUR  TOTAL SCORE IS" + " " + score3);
                      System.out.println();
                    System.out.println("                 YOU CAN BUY THE FULL VERSION OF THIS GAME FOR MORE CHALLENGES BY VISITING  THE LINK BELOW");
                  System.out.println("                                           https://www.komkigames.com                                  ");
                      System.out.println();break;}
                              counter4++;
                   
                if( counter4==3){
               System.out.println("TOO MANY ATTEMPTS    GAME OVER");
               System.out.println("YOUR TOTAL SCORE IS" + " "+ score2); break;}
                if(answer1!=720){
                 System.out.println("WRONG ANSWER TRY AGAIN");}
             }while(answer1!=1250);
               if(answer1==1250){  //end of qn4
            
                 
                 
                 
    }//if game over in qn 4
    } // if game over in qn 3
    } // if game over in qn 2
    }else //if game over in qn 1
    {break;}
       
    }break; //closing case 1
     
     
    case 2:{
    System.out.println(" Hi"+" "+ player[0]+" GET READY FOR WORDS ARRANGEMENT GAME");
              System.out.println();
              System.out.println("INSTRUCTIONS");
              System.out.println();
        System.out.println("1.THE GAME WILL HAVE 4 QUESTIONS");
        System.out.println("2.REMEMBER YOU HAVE THREE ATTEMPTS IN EACH QUESTION");
    System.out.println("3.WHAT YOU NEED TO DO HERE IS TO CORRECT THE WORDS INTO MEANINGFUL ONE");
    System.out.println("4.REMEMBER: *USE LOWER CASE FOR YOUR ANSWERS");
    System.out.println();
     
    do{
   
      System.out.println("QUESTION 1");
      System.out.println("P H A E L E N T");
             answerA=b.next();
            if(answerA.equals(names[0])){
           System.out.println("well done");
            System.out.println(" YOUR SCORE IS" + " " + scoreA);break;} 
                     counter5++;
                 if( counter5==3){
        System.out.println("TOO MANY ATTEMPTS    GAME OVER");
        System.out.println(" YOUR TOTAL SCORE IS" + " " + scoreB);break;}
                  if(answerA!=names[0]){
              System.out.println("WRONG ANSWER TRY AGAIN");}
           }while(answerA!=names[0]);
            if(answerA.equals(names[0])){ //end of qn 1
             
            System.out.println();
       do{ 
          
        System.out.println("QUESTION 2");
        System.out.println("C H O N I L A U S");
                score1=scoreA*2;
                answerA=b.next();
                  if(answerA.equals(names[1])){
                  System.out.println("nice...");
                  System.out.println(" YOUR SCORE IS" + " " + score1);break;} 
                          counter6++;
                  if( counter6==3){
               System.out.println("TOO MANY ATTEMPTS    GAME OVER");
             System.out.println(" YOUR TOTAL SCORE IS" + " " + scoreA);break;}
                  if(answerA!=names[1]){
                 System.out.println("WRONG ANSWER TRY AGAIN");}
             }while(answerA!=names[1]);
           if(answerA.equals(names[1])){ //end of qn 2
           
            System.out.println();
             
        do{
                 
            System.out.println("QUESTION 3");
          System.out.println("L A L G C O E");
                score2=scoreA*3;
                answerA=b.next();
               if(answerA.equals(names[2])){
                  System.out.println("awesome..");
                    System.out.println(" YOUR SCORE IS" + " " + score2);break;}
                           counter7++;
                       if( counter7==3){
                    System.out.println("TOO MANY ATTEMPTS    GAME OVER");
                       System.out.println(" YOUR TOTAL SCORE IS" + " " + score1);break;}
                       if(answerA!=names[2]){
                  System.out.println("WRONG ANSWER TRY AGAIN");}
             }while(answerA!=names[2]);
               if(answerA.equals(names[2])){ //end of qn 3
           
           
                        System.out.println();
                         
        do{
                             
             System.out.println("QUESTION 4");
             System.out.println("C L I P S E E");
                  score3=scoreA*4;
                  answerA=b.next();
                if(answerA.equals(names[3])){
                      System.out.println("woow..");
                             System.out.println();
                             System.out.println("           CONGRATULATION" + player[0] + "  "+ "YOUR THE MIND MASTER");
                             System.out.println(); 
                      System.out.println(" YOUR TOTAL SCORE IS" + " " + score3);
                      
                      System.out.println();
                      System.out.println("                 YOU CAN BUY THE FULL VERSION OF THIS GAME FOR MORE CHALLENGES BY VISITING  THE LINK BELOW");
                      System.out.println("                                           https://www.komkigames.com                                  ");
                      System.out.println();break;}
                                    
                                 counter8++;
                   if( counter8==3){
                      System.out.println("TOO MANY ATTEMPTS    GAME OVER");
                       System.out.println(" YOUR TOTAL SCORE IS" + " " + score2);break;}
                   if(answerA!=names[3]){
                      System.out.println("WRONG ANSWER TRY AGAIN");}
          }while(answerA!=names[3]);
                   if(answerA.equals(names[3])){ //end of qn 4
                         
                         System.out.println();
                         
                              
                                          
                                     
                         
           
                }// if game over in qn4
            }// if game over in qn 3  
            }// if game over in qn 2
            }else{break;} //if game over in qn1 
            }break; //closing of case 2
    }       

}
}


No comments